public ActionResult Edit(PostQuestion postQuestion) { if (ModelState.IsValid) { Question question = new Question(); question.PostQuestion = postQuestion.Question; question.HashTags = postQuestion.HashTags; question.Id = postQuestion.Id; question.ModifiedDate = DateTime.Now; question.OwnerUserID = postQuestion.OwnerUserID; db.Entry(question).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(postQuestion)); }
public ActionResult Edit(ViewModelUser ViewUser) { if (ModelState.IsValid) { User user = new User(); user.FirstName = ViewUser.FirstName; user.LastName = ViewUser.LastName; user.UserName = ViewUser.UserName; if (!string.IsNullOrEmpty(ViewUser.Password)) { user.Password = AesCryptography.Encrypt(ViewUser.Password); } user.Email = ViewUser.Email; string _SiteURL = WebConfigurationManager.AppSettings["SiteImgURL"]; if (ViewUser.ImageURL_data != null) { user.ImageURL = _SiteURL + "/ProfileImage/" + ViewUser.ImageURL_data.FileName; var path = Path.Combine(Server.MapPath("~/Content/Upload/ProfileImage"), ViewUser.ImageURL_data.FileName); ViewUser.ImageURL_data.SaveAs(path); } else { user.ImageURL = _SiteURL + "/ProfileImage/oposee-profile.png"; } user.CreatedDate = ViewUser.CreatedDate; //user.ImageURL = ViewUser.ImageURL; user.UserID = ViewUser.UserID; user.DeviceType = ViewUser.DeviceType; user.DeviceToken = ViewUser.DeviceToken; user.SocialID = ViewUser.SocialID; user.SocialType = ViewUser.SocialType; user.RecordStatus = "Active"; user.ModifiedDate = DateTime.Now; db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ViewUser)); }