public IActionResult Post(ServiceRequestBody body) { var serviceRequest = new ServiceRequest { Id = Guid.NewGuid(), BuildingCode = body.BuildingCode, CreatedBy = body.CreatedBy, CreatedDate = body.CreatedDate.Value, CurrentStatus = body.CurrentStatus.Value, Description = body.Description, LastModifiedBy = body.LastModifiedBy, LastUpdatedBy = body.LastUpdatedBy.Value }; _serviceRequestsStore.Create(serviceRequest); return(CreatedAtAction(nameof(Post), new { id = serviceRequest.Id }, serviceRequest)); }
public IActionResult Put(Guid id, [FromBody] ServiceRequestBody body) { if (_serviceRequestsStore.GetById(id) == null) { return(NotFound()); } var serviceRequest = new ServiceRequest { Id = id, BuildingCode = body.BuildingCode, CreatedBy = body.CreatedBy, CreatedDate = body.CreatedDate.Value, CurrentStatus = body.CurrentStatus.Value, Description = body.Description, LastModifiedBy = body.LastModifiedBy, LastUpdatedBy = body.LastUpdatedBy.Value }; _serviceRequestsStore.Update(id, serviceRequest); return(Ok()); }