public IHttpActionResult PutRoles(int id, RoleModel model) { try { _logger.Debug(string.Format("ini process - Put,idUser:{0}", CurrentIdUser)); if (id != model.Id) { _logger.Debug(string.Format("ini Put - inValid,idUser:{0}", CurrentIdUser)); return(BadRequest("Invalid ID")); } if (!ModelState.IsValid) { _logger.Debug(string.Format("ini Put - inValid,idUser:{0}", CurrentIdUser)); return(BadRequest(ModelState)); } Role role = AutoMapper.Mapper.Map <Role>(model); _roleBL.Update(role); _logger.Debug(string.Format("finish Put - success,idUser:{0}", CurrentIdUser)); return(Ok(new JsonResponse { Success = true, Message = "Role was Saved successfully", Data = role })); } catch (Exception ex) { LogError(ex); return(InternalServerError(ex)); } }
public IActionResult Put(int id, [FromBody] Role role) { role.Id = id; var updateRole = roleBL.Update(role); return(Ok(updateRole)); }
public Task UpdateAsync(TRole role) { if (role == null) { throw new ArgumentNullException("role"); } _roleBL.Update(role); return(Task.FromResult <Object>(null)); }