public ActionResult Create(GroupViewModel group) { if (Framework.GroupManager.GroupIsAlreadyExist(group.ShortName)) { throw new HttpException(403, GlobalRes_ua.forbidenAction); } if (!ModelState.IsValid) { return RedirectToRoute("Default"); } group.FacultyId = Framework.UserContext.User.FacultyId; var model = AutoMapper.Mapper.Map<Group>(group); Framework.GroupManager.Create(model); return RedirectToRoute("groupStudentList", new { groupId = group.Id }); }
public ActionResult Update(GroupViewModel group) { if (Framework.UserContext.User.FacultyId != Framework.GroupManager.GetById(group.Id).FacultyId) { throw new HttpException(403, GlobalRes_ua.error_403); } if (!ModelState.IsValid) { return View(group); } group.FacultyId = Framework.UserContext.User.FacultyId; var model = AutoMapper.Mapper.Map<Group>(group); Framework.GroupManager.Update(model); return RedirectToRoute("Default"); }