forum

Home / DeveloperSection / Forums / Inserting record using Stored procedure

Inserting record using Stored procedure

Manish Kumar162522-Mar-2017

I want to insert record using stored procedure,I am using entity framework

Here is my sample code.


please anyone help me 

 

 [HttpPost]
        publicActionResult Add(RegistrationForm Model)
        {
     using(var context = newDemoEntities())
            {
                if (Model.Id == 0)
                {
                    context.RegistrationForms.Add(Model);
                }
                else
                {
                    context.Entry(Model).State= EntityState.Modified;
                }
 
                // context.RegistrationForms.Add(Model);
                ViewData["Message"] = "Success";
 
            }
            Return View();
        }

Updated on 22-Mar-2017

Can you answer this question?


Answer

0 Answers

Liked By