public ActionResult Edit(ManagerViewModel viewModel) { if (!ModelState.IsValid) { return View(viewModel); } var manager = new Manager() { Id = Guid.Parse(User.Identity.GetUserId()), Login = viewModel.Login, Name = viewModel.Name, Position = viewModel.Position }; var result = _managerService.Create(manager); if (result) { ViewBag.Result = true; ViewBag.ResultMsg = "suc"; } else { ViewBag.Result = false; ViewBag.ResultMsg = "error update your info"; } return View(viewModel); }
public ActionResult Edit() { var userId = Guid.Parse(User.Identity.GetUserId()); var user = _managerService.Get(userId); var model = new ManagerViewModel() { Login = user?.Login ?? User.Identity.Name, Name = user?.Name ?? "", Position = user ?.Position ?? "1" }; return View(model); }