コード例 #1
0
ファイル: AccountService.cs プロジェクト: TDevs/2014_TBS
        public void DeleteRole(Role role)
        {
            using (var dbContext = new DatabaseContext())
            {

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

                if (rDel != null)
                {
                    dbContext.Roles.Remove(rDel);
                    dbContext.SaveChanges();
                }
            }
        }
コード例 #2
0
ファイル: UserController.cs プロジェクト: TDevs/2014_TBS
        public JsonResult GetCurrentRole()
        {

            var uid = User.Identity.GetUserId();
            var currentRole = accountService.GetRoles(uid).FirstOrDefault();
            if (currentRole == null)
                currentRole = new Role();
            var role = new RoleViewModel()
            {
                Name = currentRole.Name,
                Description = currentRole.Description,
                Predefined = currentRole.Predefined,
                AccountCanEdit = currentRole.AccountCanEdit,
                AccountCanView = currentRole.AccountCanView,
                AgentCanCreate = currentRole.AgentCanCreate,
                MedallionCanDelete = currentRole.MedallionCanDelete,

                BillOutMember = currentRole.BillOutMember,
                ViewMemberData = currentRole.ViewMemberData,
                ViewDeletedMembers = currentRole.ViewDeletedMembers,
                ViewMemberCashiering = currentRole.ViewMemberCashiering,
                EditMemberData = currentRole.EditMemberData,
                DeleteMemberData = currentRole.DeleteMemberData,

                ReportCanMakeReport = currentRole.ReportCanMakeReport,
                ReportCanMakeEndOfDayTrans = currentRole.ReportCanMakeEndOfDayTrans,
                RoleCanViewList = currentRole.RoleCanViewList,
                RoleCanEdit = currentRole.RoleCanEdit,
                RoleCanCreate = currentRole.RoleCanCreate,
                RoleCanDelete = currentRole.RoleCanDelete,
                UserCanViewList = currentRole.UserCanViewList,
                UserCanEdit = currentRole.UserCanEdit,
                UserCanCreate = currentRole.UserCanCreate,
                UserCanDelete = currentRole.UserCanDelete,

                ReferenceCanEdit = currentRole.ReferenceCanEdit,
                AllowDashboard = currentRole.AllowDashboard,


                IsAdmin = currentRole.Name == UserRoles.Administrator.ToString()

            };
            return Json(role, JsonRequestBehavior.AllowGet);


        }
コード例 #3
0
ファイル: RoleController.cs プロジェクト: TDevs/2014_TBS
 public ActionResult Edit(Role role)
 {
     accountService.UpdateRole(role);
     return Json(true);
 }
コード例 #4
0
ファイル: RoleController.cs プロジェクト: TDevs/2014_TBS
 public ActionResult Delete(Role role)
 {
     accountService.DeleteRole(role);
     return Json(true);
 }
コード例 #5
0
ファイル: AccountService.cs プロジェクト: TDevs/2014_TBS
 public void CreateRole(Role role)
 {
     roleRepository.Add(role);
 }
コード例 #6
0
ファイル: AccountService.cs プロジェクト: TDevs/2014_TBS
 public void UpdateRole(Role role)
 {
     roleRepository.Update(role);
 }