public IActionResult Edit(VMDentistUser ViewModel) { string error = string.Empty; if (UsersDAO.EmailRepeated(ViewModel.User)) { error += "Este e-mail já está sendo utilizado por outro usuário do sistema;"; } ViewModel.Dentist.ClinicID = Convert.ToInt32(HttpContext.Session.GetInt32("clinicId")); if (DentistsDAO.Edit(ViewModel.Dentist) <= 0) { error += "Este e-mail já está sendo utilizado por outro usuário do sistema;"; } if (!string.IsNullOrEmpty(error)) { ViewData["Section"] = "Dentistas"; ViewData["Action"] = "Editar"; ViewBag.Types = UsersDAO.GetTypes(); ViewBag.Error = error; return(View("Add", ViewModel)); } UsersDAO.Edit(ViewModel.User); return(RedirectToAction("Details", new { id = ViewModel.Dentist.ID })); }
public JsonResult Edit(User user, HttpPostedFileBase img) { if (ModelState.IsValid) { user.user_img = images.AddImages(img, "User", Guid.NewGuid().ToString()); usersDAO.Edit(user); return(Json(true, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); }
public IActionResult Edit(VMAdminUser ViewModel) { ViewModel.Admin.ClinicID = Convert.ToInt32(HttpContext.Session.GetInt32("clinicId")); if (AdministratorsDAO.Edit(ViewModel.Admin) > 0) { UsersDAO.Edit(ViewModel.User); return(RedirectToAction("Details", new { id = ViewModel.Admin.ID })); } ViewBag.Types = UsersDAO.GetTypes().Where(t => t.Name != "DEV" && t.Name != "DENTIST"); return(View("Add", ViewModel)); }
public IActionResult Edit(User Model) { if (!ModelState.IsValid) { ViewData["Section"] = "Usuários"; ViewData["Action"] = "Editar"; ViewBag.Types = UsersDAO.GetTypes(); return(View("Add", Model)); } UsersDAO.Edit(Model); return(RedirectToAction("List")); }
public ActionResult Edit(Music.Model.EF.User user, HttpPostedFileBase IMG, string del) { User us = db.Users.Find(user.user_id); user.user_bin = false; user.user_active = true; user.user_option = true; user.user_datecreate = us.user_datecreate; user.user_datelogin = DateTime.Now; user.user_id = us.user_id; user.user_point = us.user_point; user.user_vip = us.user_vip; user.user_token = Guid.NewGuid().ToString(); user.user_datevip = us.user_datevip; user.user_deadline = us.user_deadline; user.user_note = us.user_note; user.user_code = us.user_code; if (user.user_active != true && user.user_active != false) { user.user_active = false; } //Chèn ảnh if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new FilesController(); img.AddImages(IMG, Common.Link.IMG_USER, code); user.user_img = code + IMG.FileName; } else { user.user_img = us.user_img; } if (usersDAO.Edit(user)) { return(Redirect("/Admin/UsersAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }
public ActionResult Edit(User user, HttpPostedFileBase IMG) { User us = db.Users.Find(user.user_id); user.user_active = us.user_active; user.user_datecreate = us.user_datecreate; user.user_datelogin = DateTime.Now; user.user_bin = us.user_bin; user.user_option = us.user_option; user.user_code = us.user_code; user.user_token = us.user_token; var i = new ImagesController(); if (IMG != null) { var code = Guid.NewGuid().ToString(); var img = new ImagesController(); img.AddImages(IMG, Common.Link.IMG_USER, code); user.user_img = code + IMG.FileName; } else { user.user_img = us.user_img; } var dao = new UsersDAO(); if (dao.Edit(user)) { return(Redirect("/Admin/UsersAdmin")); } else { return(Redirect(Common.Link.NOT_404)); } }