forum

home / developersection / forums / inserting record using stored procedure

Inserting record using Stored procedure

Manish Kumar 1823 22-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]
        public ActionResult Add(RegistrationForm Model)
        {
     using(var context = new DemoEntities())
            {
                if (Model.Id == 0)
                {
                    context.RegistrationForms.Add(Model);
                }
                else
                {
                    context.Entry(Model).State= EntityState.Modified;
                }
 
                // context.RegistrationForms.Add(Model);
                ViewData["Message"] = "Success";
 
            }
            Return View();
        }

c# mvc4 
Updated on 22-Mar-2017
Manish Kumar

Other


Message
Can you answer this question?

Answer

0 Answers

Liked By