public IActionResult Put(int id, [FromBody] RoleDto dto, [FromServices] IUpdateRoleCommand command) { dto.Id = id; _executor.ExecuteCommand(command, dto); return(StatusCode(StatusCodes.Status204NoContent)); }
public IActionResult Put(int id, [FromBody] RoleDTO dto, [FromServices] IUpdateRoleCommand command) { dto.Id = id; _executor.ExecuteCommand(command, dto); return(NoContent()); }
public RolesController(IGetRoleCommand getRoleCommand, IGetSingleRoleCommand getSingleRoleCOmmand, IInsertRoleCommand insertRoleCommand, IUpdateRoleCommand updateRoleCommand, IDeleteRoleCommand deleteRoleCommand) { _getRole = getRoleCommand; _getSingleRole = getSingleRoleCOmmand; _insertRole = insertRoleCommand; _updateRoleCommand = updateRoleCommand; _deleteRoleCommand = deleteRoleCommand; }
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; }
public IActionResult Put([FromBody] RoleDto dto, [FromServices] IUpdateRoleCommand command) { executor.ExecuteCommand(command, dto); return(Ok(new { StatusCode = HttpStatusCode.OK, Message = "Role updated" })); }
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)); } }
public void Put([FromBody] RolePutDto dto, [FromServices] IUpdateRoleCommand command) { executor.ExecuteCommand(command, dto); }