public ActionResult Profile() { string username = (string)System.Web.HttpContext.Current.Session["username"]; user = (from u in db.portal_s_websure where u.USERNAME == username select u).FirstOrDefault(); TempData.Keep("profile"); TempData["profile"] = user; return(View()); }
public async Task <ActionResult> UpdateProfile([FromBody] portal_s_websure user) { var data = db.portal_s_websure.Find(user.USERID); //insert the username data.FIRSTNAME = user.FIRSTNAME; db.Entry(data).State = EntityState.Modified; try { await db.SaveChangesAsync(); return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (DbUpdateConcurrencyException ex) { string msg = ex.Message; return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } }