c# - How to add/insert in EF from arguments passed by jquery ajax -


how insert values jquery ajax ef table?

  [httppost]     public actionresult savescheduleappointment(string custname, string scheddate, string _starttime, string _endtime)     {      list<schedappointment> schedapt = new list<schedappointment>();        using(var db = new dcdbentities())         {          schedapt.add(new schedappointment()           {                                appointmentdate = scheddate,            customerfullname = "",            appointmentdescription = "",            customerpatientid = 0,            endtime ="",            starttime = ""            });            db.scheduleappointments.add(schedapt);            db.savechanges();          }         return view();     } 

im getting error

error 1 best overloaded method match 'system.data.entity.dbset.add(dentalclinicsystem.models.scheduleappointment)' has invalid arguments c:\users\francisco.l.saul\documents\visual studio 2013\projects\dentalclinicsystem\dentalclinicsystem\controllers\schedulecontroller.cs 44 17 dentalclinicsystem

change schedapt single appointment, not list:

  [httppost]     public actionresult savescheduleappointment(string custname, string scheddate, string _starttime, string _endtime)     {       using(var db = new dcdbentities())         {          //here - use scheduleappointment not schedappointment          scheduleappointment schedapt = new scheduleappointment           {                 // may need change properties ones in new class                            appointmentdate = scheddate,            customerfullname = "",            appointmentdescription = "",            customerpatientid = 0,            endtime ="",            starttime = ""            };             //alternatively, might need change bit list of schedappointment             db.scheduleappointments.add(schedapt);            db.savechanges();          }         return view();     } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -