예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
        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");
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
 public void UpdateRoleDetached(Role e)
 {
     utOfWork.RoleRepository.UpdateRoleDetached(e);
 }
예제 #6
0
    public void CreateRole(Role Role)
    {

        utOfWork.RoleRepository.Add(Role);

    }
예제 #7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Roles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRoles(Role role)
 {
     base.AddObject("Roles", role);
 }
예제 #8
0
 /// <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;
 }