public async Task <ActionResult <TypeofRights> > Put(Guid id, [FromBody] TypeofRights typeofRight) { try { var result = typeOfRightRepo.Retrieve().FirstOrDefault(x => x.Role_TypeID == id); if (result == null) { return(NotFound()); } await typeOfRightRepo.UpdateAsync(id, typeofRight); return(Ok(typeofRight)); } catch (Exception) { return(BadRequest()); } }
public async Task <ActionResult <TypeofRights> > Post([FromBody] TypeofRights typeOfRight) { try { typeOfRight.Role_TypeID = Guid.NewGuid(); await typeOfRightRepo.CreateAsync(typeOfRight); return(CreatedAtRoute("GetTypeOfRightByID", new { id = typeOfRight.Role_TypeID }, typeOfRight)); } catch (Exception) { return(BadRequest()); } }