Questions tagged as 'c#'

1
answer

AuthorizeAttribute in Controlller and Actions

When using an attribute (AuthorizeAttribute) developed by me (with Enums), it is not working as it should: When used to decorate the Controller declaration: [UserTypeAuthorize(TipoUsuario.Administrador)] public class UsuarioController : Bas...
asked by 12.01.2017 / 04:08
1
answer

How to get filenames inside folders on WEB server API

I have a directory File / Uploads AndIwouldliketolistallfiles,insidethisdirectoryIhaveNfolders.WhatI'veachievedsofarishere.stringpath=HttpContext.Current.Server.MapPath("~//Arquivos//Uploads"); string[] files = System.IO.Direct...
asked by 08.01.2017 / 00:20
1
answer

How to return string array of each book with its chapters and verses?

Follow the code below: var linha = string.Empty; List<List<String>> livros = new List<List<String>>(); string[] filesArray = new DirectoryInfo($@"{pathname}\Biblia\JFA").GetFiles().Select(x => x.Name).ToArray(); fo...
asked by 10.12.2017 / 19:27
1
answer

Compiler indicates non existent enum that exists

I'm using the Mono compiler. When I tried to compile this: using static System.Globalization.CharUnicodeInfo; using static System.Globalization.UnicodeCategory; namespace AS3Kit.Lexical { static class Validator { static bool T...
asked by 12.12.2017 / 00:17
1
answer

MIgrations, Updating a null field to not null

I'm updating the phone and CPF field of my User entity that was allowing nulls to non-null. follow the migration file public partial class Required_fild_users_cpf_phone : DbMigration { public override void Up() { AlterColumn("d...
asked by 01.12.2017 / 14:38
1
answer

Task is not called

Personal I have an api where its processing takes around 6 hours of execution, so I added a Task.Factory.StartNew with the main processing. So when someone calls, it responds to StatusCode 200 and continues "heavy" processing with the Task: pu...
asked by 27.11.2017 / 19:36
3
answers

Dollar next to number in ToString formatting

When I try to format a value using .ToString("c2") .NET, the currency symbol is stuck with the number. This makes the formatting ugly and wrong to my point of view. Example: cdec("1234.56").toString("c2") | Resultando: "R$1.234,56"...
asked by 03.12.2017 / 16:22
3
answers

LINQ with JOIN and where clause, how to do?

Good afternoon. I'm trying to make a left outer join (SQL) with LINQ, however, I'm not getting it. The code for my class, this is below. Can anyone give me a light on how to solve this? public class PessoaController : Controller {...
asked by 01.01.2018 / 17:46
2
answers

LINQ using function within select new {} with lambda expression

I am assembling a select, with the Entity Framework, that needs to "create a column" according to 4 criteria. I'm trying this way: IQueryable<ImoveisDTO> Resultado = ctx.Imoveis.Select(ib => new ImoveisDTO { idImovel = ib.idImovel...
asked by 04.01.2018 / 13:04
1
answer

How to control migrations two different contexts?

I have two contexts and would like to know how to activate each of them. For example Add-Migration Contexto 1, Add-Migration 2 How can I add new migrations for each context?     
asked by 10.01.2018 / 09:55