public ActionResult AddOperation(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Operations operations = new Operations { Id = (int)id }; return View(operations); }
public ActionResult AddOperation(Operations model) { if (ModelState.IsValid) { Operation NewOperation = gm.AddOperation(model.Id, model.OperationId); List<User> Users = gm.FindGroup(model.Id).Users.ToList(); UserManager um = new UserManager(new DBContext()); foreach(User user in Users) { if (!user.Operations.Contains(NewOperation)) { um.AddOperation(user.Id, model.OperationId); } } return RedirectToAction("Details", new { Id = model.Id }); } return View(model); }
public ActionResult AddOperation(Operations model) { if (ModelState.IsValid) { um.AddOperation(model.Id, model.OperationId); return RedirectToAction("Details", new { Id = model.Id }); } return View(model); }