public JsonResult DeleteLead(int id) { bool flag = false; try { Lead vlead = db.Leads.Where(p => p.ID == id).FirstOrDefault(); vlead.Is_Active = false; db.Entry(vlead).State = System.Data.EntityState.Modified; db.SaveChanges(); flag = true; } catch (Exception e) { flag = false; } if (flag) { return(Json(new { success = true, statuscode = 200, msg = "Successfull" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, statuscode = 500, msg = "Failed" }, JsonRequestBehavior.AllowGet)); } }
public JsonResult ChangePassword(RegisterUserModel reg) { var user = db.USERs.Where(c => c.ID == reg.ID).FirstOrDefault(); user.Password = reg.Password; db.Entry(user).State = System.Data.EntityState.Modified; db.SaveChanges(); return(Json(new { status = "Ok", code = 400, msg = "Password Changed" }, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteNotification() { int userid = Convert.ToInt32(Session["UserId"].ToString()); var notifications = db.notifications.Where(p => p.N_To == userid && p.IsRead == false).OrderByDescending(p => p.ID).ToList(); foreach (notification n in notifications) { n.IsRead = true; db.Entry(n).State = System.Data.EntityState.Modified; db.SaveChanges(); } return(Json(new { code = 200 }, JsonRequestBehavior.AllowGet)); }