public ActionResult Create(ProjectViewModel data) { Project model = Mapper.Map<ProjectViewModel, Project>(data); try { string currentUserId = User.Identity.GetUserId(); model.CreatedOn = DateTime.Now; model.UpdatedOn = DateTime.Now; model.CreatedByUser = _userService.GetUserByGuid(User.Identity.GetUserId()); ; _projectService.CreateProject(model); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(ProjectViewModel data) { Project model = Mapper.Map<ProjectViewModel, Project>(data); try { // TODO: Add update logic here // model.UpdatedOn = DateTime.Now; //model.ModifiedBy = _userService.GetUserByGuid(User.Identity.GetUserId()); model.ModifiedById = User.Identity.GetUserId(); _projectService.UpdateProject(model); return RedirectToAction("Index"); } catch { return View(); } }