public ActionResult CreateRole(Role Catm, FormCollection collection) { if (ModelState.IsValid) { try { if (etat) { BissInventaireEntities.Instance.Role.Add(Catm); BissInventaireEntities.Instance.SaveChanges(); return RedirectToAction("GetRole"); } else { return RedirectToAction("Index", "Error"); } } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } } else { return View(); } }
public void TearDown() { _userRoleLink = _userRoleLinkRepository.Get(_userRoleLink.Id); _userRoleLinkRepository.Delete(_userRoleLink); _user = _userRepository.Get(_user.Id); _userRepository.Delete(_user); _role = _roleRepository.Get(_role.Id); _roleRepository.Delete(_role); _burrow.CloseWorkSpace(); }
public ActionResult Edit(Role role, FormCollection collection) { try { db.UpdateRoleDetached(role); db.SaveRole(); return RedirectToAction("GetRole"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } }
public void CreateUser() { _fixture = new Fixture(); _role = new Role {Name = _fixture.Create<string>()}; _roleRepository.Save(_role); _user = new User {Name = _fixture.Create<string>()}; _userRepository.Save(_user); _userRoleLink = new UserRoleLink(_user,_role); _userRoleLinkRepository.Save(_userRoleLink); _burrow.CloseWorkSpace(); _burrow.InitWorkSpace(); Assert.AreEqual(_userRepository.FindByRoleId(_role.Id).ToList().First(), _user); }
public void UpdateRoleDetached(Role e) { utOfWork.RoleRepository.UpdateRoleDetached(e); }
public void CreateRole(Role Role) { utOfWork.RoleRepository.Add(Role); }
/// <summary> /// Deprecated Method for adding a new object to the Roles EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRoles(Role role) { base.AddObject("Roles", role); }
/// <summary> /// Create a new Role object. /// </summary> /// <param name="name">Initial value of the Name property.</param> /// <param name="id">Initial value of the Id property.</param> public static Role CreateRole(global::System.String name, global::System.Int32 id) { Role role = new Role(); role.Name = name; role.Id = id; return role; }