public async Task <IHttpActionResult> Post(int id, DriveTypeInputModel model) { DriveType driveType = new DriveType() { Id = model.Id, VehicleToDriveTypeCount = model.VehicleToDriveTypeCount }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment, }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _driveTypeApplicationService.DeleteAsync(driveType, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(DriveTypeInputModel driveTypeInputModel) { DriveType driveType = new DriveType() { Id = driveTypeInputModel.Id, Name = driveTypeInputModel.Name }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = driveTypeInputModel.Comment }; var attachments = SetUpAttachmentsModels(driveTypeInputModel.Attachments); var changeRequestId = await _driveTypeApplicationService.AddAsync(driveType, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Replace(int id, DriveTypeInputModel model) { DriveType driveType = new DriveType() { Id = model.Id, Name = model.Name, VehicleToDriveTypes = model.VehicleToDriveTypes.Select(item => new VehicleToDriveType { DriveTypeId = item.DriveTypeId, Id = item.Id, VehicleId = item.VehicleId }).ToList(), }; CommentsStagingModel comment = new CommentsStagingModel { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _driveTypeApplicationService.ReplaceAsync(driveType, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }