public ActionResult Edit([Bind(Include = "Id,ServiceId,JobId,AppId,Recipient,Message,SendDT,Status")] Notifications notifications) { if (ModelState.IsValid) { db.Entry(notifications).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(notifications)); }
public string updateRecord(int serviceId) { using (ChatServerModelContainer context = new ChatServerModelContainer()) { // "id" is the id in your table (parameter passed) Notifications jnr = context.Notifications.Where(n => n.ServiceId.Equals(serviceId)).FirstOrDefault(); jnr.Status = "Sent"; context.Entry(jnr).State = EntityState.Modified; context.SaveChanges(); return("Sent"); } }
public void updateRecord(string serviceId) { // "id" is the id in your table (parameter passed) int svcID = Int32.Parse(serviceId); string status = "Sent"; Notifications jnr = db.Notifications.Where(n => n.ServiceId.Equals(svcID)).FirstOrDefault(); jnr.Status = status; db.Entry(jnr).State = EntityState.Modified; db.SaveChanges(); Context.Response.Clear(); Context.Response.ContentType = "application/json"; Context.Response.Write(JsonConvert.SerializeObject(status, Newtonsoft.Json.Formatting.Indented)); }