Questions tagged as 'entity-framework'

2
answers

Disable DropDownList in View

Class public class ConfiguracaoEstado { .... [Required(ErrorMessage = "Selecione ao menos um estado.")] [Display(Name = "Estado")] public int EstadoID { get; set; } ... } Controller private void createViewBag(ConfiguracaoEstad...
asked by 10.02.2015 / 16:47
1
answer

Entity Framework Navigation Property

I am trying to run the following code, but this one giving error where it is trying to insert the state back into my bank, however it was fetched through another connection I know that a solution would be to set the state directly, but I woul...
asked by 23.10.2014 / 18:08
1
answer

Filter search with Checkbox values

For example, the user entered the title of a publication, and marked the genres Action and Adventure, or the user did not enter any title, but want to see all the publications that fit into these genres. How can I do this search query? My tab...
asked by 17.11.2014 / 00:48
1
answer

How to make an in in lambda?

I have a function convertStringListaInt with parameter String . Example: String: 1,2 . I'm converting this string to a List of type convertStringListaInt_Result having property number (integer). How can...
asked by 03.11.2014 / 13:59
1
answer

Type conversion error with EntityFramework: Can not convert an object of type 'System.Collections.Generic.HashSet'1 []'

I'm getting this error when trying to write a new record of Atendimento .    Can not convert an object of type 'System.Collections.Generic.HashSet'1 [Domain.AccessAbout]' to type 'Domain.AccessAbout'. Classes: Service : publ...
asked by 28.10.2014 / 13:20
1
answer

Execute procedure with CodeFirst

I'm trying to run a procedure in ASP.NET MVC with CodeFirst. I saw some examples on the internet but they are not working, can anyone help me? public void Copiadados(int Cod_Cli, int Cod_Obra) { SqlParameter p1 = ne...
asked by 13.08.2014 / 19:55
1
answer

Shopping Cart Implementation in ASP.NET MVC

I'm trying to build a "simple" sales system, however, I do not have any knowledge in e-commerce. What I want is the following: The user chooses the products he wants, assembles a cart, and completes the order. Then my question starts: the car...
asked by 18.11.2014 / 06:53
2
answers

jquery method does not pass parameters to controller

Jquery does not pass parameters to controller. The values are coming in blank. Jquery: function GravaEvento() { var str = ""; var parametros = jQuery.parseJSON('{ "DE_Cnpj": "' + $("#txtCnpj").val() + '" , "DE_Descricao": "' + $("#txtDe...
asked by 04.07.2014 / 00:06
1
answer

Make a foreach that does not repeat the same data

I have this foreach, in a table with more than 5000 records. There are only 6 types of business unit. I would like in foreach and linq, when a type of un appears, it loads and then no longer repeats it, ie, it loads another different one and so...
asked by 22.09.2014 / 16:50
1
answer

___ ___ erkimt Error adding HttpPost the controller ______ qstntxt ___

I have a problem in time to add the attribute %code% on my controller. I mean, I can add the attribute without problems, but when I compile and go to the form registration I just can not access.

I get the following error:

  

Server Error in Application '/'.

     

Can not find the resource.

     

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could not be removed, had its name changed, or is temporarily unavailable. Examine the URL and make sure that it is spelled correctly.

     

requested URL: / User / add

Version Information: Microsoft .NET Framework Version: 4.0.30319; ASP.NET:4.0.30319.33440

Also, when I take %code% % attribute, I can not see the registration form, but I can not do the insert in the bank.

    
______ ___ azszpr31034

When you add the HttpPost attribute in an action. It can only be accessed via the HTTP POST method.

If your intention is to only display the form. Do not decorate your method with no attributes, the default is GET.

What you can do is set an Add method with no attribute. This method will be accessed via GET and display the form.

Then you create a second method, for example AdicionarConfirmado, decorated with the attributes and HttpPost ActionName="Add"

The methods can no defined as follows

%pre%

Since your form that will save the record would look like this:

%pre%     
___

I have a problem in time to add the attribute [HttpPost] on my controller. I mean, I can add the attribute without problems, but when I compile and go to the form registration I just can not access. I get the following error:    Ser...
asked by 01.09.2014 / 04:06