Questions tagged as 'c#'

1
answer

Authorization in class libraries

Doubt I have a project where the entire business rule is encapsulated in a set of DLLs with 3-tier architecture. I wonder, what is the best approach for authorization control in these dll's. Is it possible to use Identity? Is there a des...
asked by 06.01.2015 / 17:15
1
answer

What is Bind (Include="Property") used for?

When we create a CRUD with scalfold in ASP.NET MVC, in the POST methods, we have the following code: public ActionResult Create([Bind(Include = "Id,Nome")] Grupo grupo) {...} What is this [Bind] used for? When we use Gru...
asked by 29.12.2014 / 23:31
2
answers

View's Responsibilities

Throughout the internet, I find posts warning you of the responsibility of View who should only watch over your name and display content. While understanding that MVC is based exactly on the distribution of functions and separation of...
asked by 23.08.2014 / 13:26
1
answer

Compare DateTime field in a lambda only part Date

In this lambda, the result will almost always be null, since I gave a GetDate () right in the bank and when this happens, I record Date and Time. How do I make this lambda pass only date and compare with DateTime.Now just the date? I tried to us...
asked by 02.06.2014 / 20:12
3
answers

Return Json from object in C # with Entity Framework

I have a problem with returning a Json using Entity Framework. The code I'm using is: [AcceptVerbs(HttpVerbs.Get)] public JsonResult Item(int agendaHorarioID) { using (var db = new ERPContext()) { IList<AgendaHorario> age...
asked by 20.05.2014 / 13:47
2
answers

In-doubt of inheritance in C #

I'm trying to solve an inheritance exercise and I found a question I saw that has a chance of appearing elsewhere and so I thought I should ask here. The exercise would ask you to first create a Voo class that represents an airplane fligh...
asked by 17.05.2014 / 03:37
2
answers

Where to call SaveChanges () when you have multiple repositories?

I'm developing an application with Entity Framework, with several repositories. Each repository encapsulates SaveChanges() of DbContext. When a business layer operation uses multiple repositories, and data changes, I need to call...
asked by 13.08.2015 / 13:08
2
answers

Extract .ZIP file with accent on name

I'm using the System.IO.Compression.ZipFile lib to unzip .zip files and I came across a major problem when trying to extract files that have accents in the name. If I try to extract with UTF-8 encoding : ZipFile.ExtractToDirectory...
asked by 21.07.2015 / 16:39
2
answers

Rendering Partials in ASP.NET MVC

I'm having a problem in my application where I wanted to use partial to render one page inside another. That is, one controller inside another. But what happens is the partial does not render at all and I've done almost everything, but it does n...
asked by 15.05.2014 / 15:26
3
answers

"Gambiarra" in C # with XML, I would like suggestions for improvement

I have this code without the "gambiarra", which returns the list with the values repeated: var s = (from p in xmlDoc.Descendants("pais") let Nomepais = p.Element("nome-pais").Value let nome...
asked by 30.04.2014 / 15:24