예제 #1
0
        public ActionResult CreateRole(Role role)
        {
            User user = uService.GetSingleUserByEmail(HttpContext.User.Identity.Name);
            var accountsetting = setService.GetAllByUserId(user.Id);
             var logObj = _companyViewLog.GetLastViewCompanyByUserId(user.Id);

            //role.CompanyId = accountsetting.Companies.Id;
             role.CompanyId = logObj.Companies.Id;
            if (rService.AddRole(role))
                return RedirectToAction("Index");
            else return Content("Failed to add Role");
        }
예제 #2
0
 public bool EditRole(Role role)
 {
     try
     {
         role.State = ObjectState.Modified;
         roleRep.UpdateOperation(role);
         return true;
     }
     catch (Exception ex)
     {
         var rr = ex.Message;
         return false;
     }
 }
예제 #3
0
 public bool AddRole(Role role)
 {
     try
     {
         role.State = ObjectState.Added;
         roleRep.AddOperation(role);
         return true;
     }
     catch (Exception ex)
     {
         var rr = ex.Message;
         return false;
     }
 }
예제 #4
0
 public ActionResult EditRole(Role  role)
 {
     rService.EditRole(role);
     //return View();
     return RedirectToAction("Index");
 }