public HttpResponseMessage Post([FromBody] UsersInRoles usersInRoles) { if (ModelState.IsValid) { if (_usersInRoles.CheckRoleExists(usersInRoles)) { usersInRoles.UserRolesId = 0; _usersInRoles.RemoveRole(usersInRoles); var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK // Status code: 200 }; return(response); } else { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.Conflict // Status code: 409 }; return(response); } } else { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest // Status code: 400 }; return(response); } }
public IActionResult Post([FromBody] UsersInRoles usersInRoles) { if (ModelState.IsValid) { if (_usersInRoles.CheckRoleExists(usersInRoles)) { usersInRoles.UserRolesId = 0; _usersInRoles.RemoveRole(usersInRoles); return(Ok()); } else { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.Conflict }; return(Conflict()); } } return(BadRequest()); }
public HttpResponseMessage RemoveRole([FromBody] RoleRightsMaster usersInRoles) { if (ModelState.IsValid) { if (_usersInRoles.CheckRoleExists(usersInRoles)) { usersInRoles.RoleRightsMappingID = 0; _usersInRoles.RemoveRole(usersInRoles); var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK }; return(response); } else { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.Conflict }; return(response); } } else { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest }; return(response); } }