Exemple #1
0
        // creates a new role
        public RoleDto CreateRole(RoleDto role)
        {
            var newRole = role.ToModel();

            _applicationDbContext.Role.Add(newRole);

            return(newRole.ToDto());
        }
        public IHttpActionResult Post([FromBody] RoleDto roleDto)
        {
            Role role = roleDto.ToModel();

            shoppingEntities.Roles.Add(role);
            shoppingEntities.SaveChanges();

            return(Ok(new RoleDto(role)));
        }
        public IHttpActionResult Put(Guid roleId, RoleDto roleDto)
        {
            var role = shoppingEntities.Roles.FirstOrDefault(t => t.Id == roleId);

            if (role == null)
            {
                throw new BadRequestException("Role không tồn tại");
            }

            roleDto.ToModel(role);

            shoppingEntities.SaveChanges();
            return(Ok(new RoleDto(role)));
        }
 public bool UpdateRoleGroup(RoleDto dto)
 {
     return(Unit.RoleRepository.UpdateRole(dto.ToModel <GIS.Authority.Entity.Role>()));
 }
 public bool AddRole(RoleDto dto)
 {
     return(Unit.RoleRepository.AddRole(dto.ToModel <GIS.Authority.Entity.Role>()));
 }
 public bool UpdateRole(RoleDto dto)
 {
     return(Unit.RoleRepository.UpdateRole(dto.ToModel <ECIT.GIS.Entity.Role>()));
 }
 public bool AddRole(RoleDto dto)
 {
     return(Unit.SystemRepository.AddSystem(dto.ToModel <ECIT.GIS.Entity.System>()));
 }