Questions tagged as 'c#'

1
answer

NHibernate QuerySyntaxException

I'm trying to return the amount of objects a query will return. If I run the following command: query.ToList().Count The value is returned successfully, however if you execute the following command: query.Count() The following error...
asked by 26.09.2018 / 16:40
1
answer

Output ASP .NET MVC Cache

I am studying about the output cache in Asp .NET MVC to improve the performance of my application. From what I've seen it can be stored in various places like: · Any · Client · Downstream · Server · None · ServerAndClient Doubt If I ca...
asked by 13.11.2018 / 10:22
2
answers

Enter comma after checking more than one name

foreach (var user in users) { var strTypesModel = ""; foreach (var typesModel in user.typesModel) { strTypesModel = strTypesModel + typesModel.Name; } user.TypesModelAggregate = strTypesModel; } I want to insert a...
asked by 18.09.2018 / 16:31
1
answer

How to ensure that the generated JSON does not return error to the Client?

I created a Web API that returns a JSON and has a problem similar to the JSONP: status code 200 OK and anyway returns $ .Ajax (... error: function () ...) . The client consumes the API with Nodes like this: refresh() { axios...
asked by 18.09.2018 / 14:40
1
answer

Pass controller error to the view

I am making a basic login form and find myself in the following situation: I want to return an error if the user does not exist in the database and I am doing this using "ModelState.AddModelError". However, when I log in I go back to the f...
asked by 18.09.2018 / 16:53
1
answer

How to redirect the user to a specified page after login

I am able to login by user type: admin or common. And I'm using:    [Authorize (Roles="Administrator")] and   [Authorize (Roles="Common")] Within the Controllers I want to restrict by type of user that can access it. But I would like to m...
asked by 21.10.2018 / 02:22
1
answer

How to make a LINQ query that returns the amount of people who were born per month?

I would like to make a LINQ query that returns the amount of people who were born in the month. In MySQL I make this query: SELECT COUNT(*) AS DataNacimento FROM pessoas WHERE MONTH (DataNascimento) = '12'; In LINQ I tried this query, bu...
asked by 24.11.2018 / 20:44
2
answers

Write checkbox value in sql server database

I have DataGridView and it contains checkbox , I need to write the value in the database, how can I do this insert in the database, the field in the database is like 0=false e 1=true, Only the parameter in my code is passing...
asked by 11.08.2018 / 00:41
2
answers

Get next record in a clustered foreach

How could I be selecting the next record within a grouped foreach before it ends, without advancing in that loop ? The point where I think I might be getting this information is where GET THE NEXT ID DESSE FOREACH is written in the...
asked by 09.08.2018 / 16:24
3
answers

How to do Update in Linq?

My project has the Delete method, but it definitely deletes the record from the table in the database. I would like to instead of delete, change the column record, I have a field called "Status", this field is an Enum with two options "Enable...
asked by 09.11.2018 / 16:34