public IActionResult Put(int id, [FromBody] RoleDto dto, [FromServices] IUpdateRoleCommand command)
        {
            dto.Id = id;

            _executor.ExecuteCommand(command, dto);
            return(StatusCode(StatusCodes.Status204NoContent));
        }
Esempio n. 2
0
        public IActionResult Put(int id, [FromBody] RoleDTO dto, [FromServices] IUpdateRoleCommand command)
        {
            dto.Id = id;

            _executor.ExecuteCommand(command, dto);

            return(NoContent());
        }
Esempio n. 3
0
 public RolesController(IGetRoleCommand getRoleCommand, IGetSingleRoleCommand getSingleRoleCOmmand, IInsertRoleCommand insertRoleCommand, IUpdateRoleCommand updateRoleCommand, IDeleteRoleCommand deleteRoleCommand)
 {
     _getRole           = getRoleCommand;
     _getSingleRole     = getSingleRoleCOmmand;
     _insertRole        = insertRoleCommand;
     _updateRoleCommand = updateRoleCommand;
     _deleteRoleCommand = deleteRoleCommand;
 }
Esempio n. 4
0
 public RolesController(IDeleteRoleCommand deleteRoleCommand, IGetRoleCommand getRoleCommand, IGetRolesCommand getRolesCommand, IInsertRoleCommand insertRoleCommand, IUpdateRoleCommand updateRoleCommand)
 {
     this.deleteRoleCommand = deleteRoleCommand;
     this.getRoleCommand    = getRoleCommand;
     this.getRolesCommand   = getRolesCommand;
     this.insertRoleCommand = insertRoleCommand;
     this.updateRoleCommand = updateRoleCommand;
 }
Esempio n. 5
0
 public IActionResult Put([FromBody] RoleDto dto, [FromServices] IUpdateRoleCommand command)
 {
     executor.ExecuteCommand(command, dto);
     return(Ok(new { StatusCode = HttpStatusCode.OK, Message = "Role updated" }));
 }
Esempio n. 6
0
        public async Task <IActionResult> UpdateRole(Guid roleId, UpdateRoleRequest role, [FromServices] IUpdateRoleCommand command)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                RoleResponse response = await command.ExecuteAsync(roleId, role);

                return(CreatedAtRoute("GetSingleRole", new { roleId = response.Id }, response));
            }
            catch (CannotCreateRoleExeption exception)
            {
                foreach (var error in exception.Errors)
                {
                    ModelState.AddModelError(exception.Message, error.Description);
                }
                return(BadRequest(ModelState));
            }
        }
Esempio n. 7
0
 public void Put([FromBody] RolePutDto dto, [FromServices] IUpdateRoleCommand command)
 {
     executor.ExecuteCommand(command, dto);
 }