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();
            }
        }
Esempio n. 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();
        }
Esempio n. 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");
            }
        }
Esempio n. 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);
        }
Esempio n. 5
0
 public void UpdateRoleDetached(Role e)
 {
     utOfWork.RoleRepository.UpdateRoleDetached(e);
 }
Esempio n. 6
0
    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&lt;T&gt; 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;
 }