public async Task <IHttpActionResult> Post(int id, RegionInputModel regionInputModel) { // create make and list of comments Region region = new Region() { Id = regionInputModel.Id }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = regionInputModel.Comment }; var attachments = SetUpAttachmentsModels(regionInputModel.Attachments); var changeRequestId = await _regionApplicationService.DeleteAsync(region, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Put(int id, RegionInputModel updateRegion) { if (updateRegion == null) { return(BadRequest(ErrorMessage.Region.RequiredRegionInputModel)); } if (updateRegion.Name == null) { return(BadRequest(ErrorMessage.Region.RequiredRegion)); } if (updateRegion.RegionAbbr == null) { return(BadRequest(ErrorMessage.Region.RegionAbbreviation)); } if (updateRegion.RegionAbbr == null) { return(BadRequest(ErrorMessage.Region.RegionAbbreviation)); } Region region = new Region() { Id = updateRegion.Id, Name = updateRegion.Name, ParentId = updateRegion.ParentId, RegionAbbr = updateRegion.RegionAbbr, RegionAbbr_2 = updateRegion.RegionAbbr_2, VehicleCount = updateRegion.VehicleCount }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = updateRegion.Comment }; var attachments = SetUpAttachmentsModels(updateRegion.Attachments); var changeRequestId = await _regionApplicationService.UpdateAsync(region, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(RegionInputModel newRegion) { if (newRegion == null) { return(BadRequest(ErrorMessage.Region.RequiredRegionInputModel)); } if (newRegion.Name == null) { return(BadRequest(ErrorMessage.Region.RequiredRegion)); } if (newRegion.RegionAbbr == null) { return(BadRequest(ErrorMessage.Region.RequiredRegion)); } Region region = new Region() { Id = newRegion.Id, Name = newRegion.Name, ParentId = newRegion.ParentId, RegionAbbr = newRegion.RegionAbbr, RegionAbbr_2 = newRegion.RegionAbbr_2 }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = newRegion.Comment }; var attachments = SetUpAttachmentsModels(newRegion.Attachments); var changeRequestId = await _regionApplicationService.AddAsync(region, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }