public virtual IActionResult RentalRequestsIdHistoryGet([FromRoute] int id, [FromQuery] int?offset, [FromQuery] int?limit) { bool exists = _context.HetRentalRequest.Any(a => a.RentalRequestId == id); // not found if (!exists) { return(new NotFoundObjectResult(new HetsResponse("HETS-01", ErrorViewModel.GetDescription("HETS-01", _configuration)))); } return(new ObjectResult(new HetsResponse(RentalRequestHelper.GetHistoryRecords(id, offset, limit, _context)))); }
public virtual IActionResult RentalRequestsIdHistoryPost([FromRoute] int id, [FromBody] HetHistory item) { bool exists = _context.HetRentalRequest.Any(a => a.RentalRequestId == id); if (exists) { HetHistory history = new HetHistory { HistoryId = 0, HistoryText = item.HistoryText, CreatedDate = item.CreatedDate, RentalRequestId = id }; _context.HetHistory.Add(history); _context.SaveChanges(); } return(new ObjectResult(new HetsResponse(RentalRequestHelper.GetHistoryRecords(id, null, null, _context)))); }