public ActionResult UpdateHistory(int id = 0) { var query = (from Falw in db.FollowAlerts where Falw.AlertId == id join typec in db.Typeofconversations on Falw.TypeofconversationId equals typec.TypeofconversationId select new { AlertId = Falw.AlertId, Comments = Falw.Comments, FollowUpDate = Falw.FollowUpDate, FollowUpHH = Falw.FollowUpHH, FollowUpMM = Falw.FollowUpMM, FollowUpAMPM = Falw.FollowUpAMPM, TypeofconversationName = typec.TypeofconversationName, }).FirstOrDefault(); if (query != null) { FollowAlerts followAlerts = new FollowAlerts() { AlertId = query.AlertId, Comments = query.Comments, FollowUpDate = query.FollowUpDate, FollowUpHH = query.FollowUpHH + ':' + query.FollowUpMM + query.FollowUpAMPM, TypeofconversationName = query.TypeofconversationName, }; return(View(followAlerts)); } else { return(HttpNotFound()); } }
public ActionResult UpdateHistory(FollowAlerts followAlerts) { if (ModelState.IsValid) { string sqlqry = "UPDATE FollowAlerts SET Comments=@Comments Where AlertId=@AlertId"; List <SqlParameter> parameterList = new List <SqlParameter>(); parameterList.Add(new SqlParameter("@AlertId", followAlerts.AlertId)); parameterList.Add(new SqlParameter("@Comments", followAlerts.Comments)); SqlParameter[] parameters = parameterList.ToArray(); int result = (int)db.Database.ExecuteSqlCommand(sqlqry, parameters); TempData["successmsg"] = "Update Successfully"; } return(RedirectToAction("UpdateHistory", "CRM", new { id = followAlerts.AlertId })); }