Exemple #1
0
 public ActionResult EditRole(Role model)
 {
     if (model != null)
     {
         userService.UpdateRole(model);
         return Json(true, JsonRequestBehavior.AllowGet);
     }
     return Json(false, JsonRequestBehavior.AllowGet);
 }
Exemple #2
0
 public ActionResult CreateRole(Role model)
 {
     if (model != null)
     {
         model.Id = Guid.NewGuid().ToString();
         userService.CreateRole(model);
         return Json(true, JsonRequestBehavior.AllowGet);
     }
     return Json(false, JsonRequestBehavior.AllowGet);
 }
Exemple #3
0
 /// <summary>
 /// Update role
 /// </summary>
 /// <param name="role"></param>
 public void UpdateRole(Role role)
 {
     role.UserRoles = null;
     roleRepository.Update(role);
 }
Exemple #4
0
 public void CreateRole(Role role)
 {
     roleRepository.Add(role);
 }
Exemple #5
0
        /// <summary>
        /// Update a role
        /// </summary>
        /// <param name="role"></param>
        public void DeleteRole(Role role)
        {
            using (var dbContext = new DatabaseContext())
            {

                var rDel = dbContext.Roles.FirstOrDefault(r => r.Id.Equals(role.Id));

                if (rDel != null)
                {
                    dbContext.Roles.Remove(rDel);
                    dbContext.SaveChanges();
                }
            }
        }