public HttpResponseMessage AddCizitenVisit() { HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request; SM_VisitsModel model = new SM_VisitsModel(); model.citizenid = request.Form["citizenid"]; model.contact = request.Form["contact"]; model.processopinion = request.Form["processopinion"]; model.returnvisit = Convert.ToInt32(request.Form["returnvisit"]); model.satisfaction = Convert.ToInt32(request.Form["satisfaction"]); model.processmode = Convert.ToInt32(request.Form["processmode"]); if (!string.IsNullOrEmpty(request.Form["visittime"])) { model.visittime = Convert.ToDateTime(request.Form["visittime"]); } model.respondents = request.Form["respondents"]; model.returnvisitcontent = request.Form["returnvisitcontent"]; model.createtime = DateTime.Now; model.createuserid = Convert.ToInt32(request.Form["userid"]); SM_VisitsBLL bll = new SM_VisitsBLL(); bll.AddVisits(model); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html"); return(response); }
public int AddVisits(SM_VisitsModel smmodel) { using (Entities db = new Entities()) { sm_visits model = new sm_visits(); //string id = ""; model.citizenid = smmodel.citizenid; model.visittime = smmodel.visittime; model.respondents = smmodel.respondents; model.contact = smmodel.contact; model.returnvisit = smmodel.returnvisit; model.returnvisitcontent = smmodel.returnvisitcontent; model.satisfaction = smmodel.satisfaction; model.processmode = smmodel.processmode; model.processopinion = smmodel.processopinion; model.createtime = smmodel.createtime; model.createuserid = smmodel.createuserid; db.sm_visits.Add(model); return(db.SaveChanges()); } }
public int AddVisits(SM_VisitsModel smmodel) { return(dal.AddVisits(smmodel)); }