public async Task <IHttpActionResult> Put(int id, VehicleTypeInputModel m) { if (m == null) { return(BadRequest(ErrorMessage.Type.RequiredTypeInputModel)); } if (m.Name == null) { return(BadRequest(ErrorMessage.Type.RequiredType)); } VehicleType type = new VehicleType() { Id = m.Id, Name = m.Name, VehicleTypeGroupId = m.VehicleTypeGroupId, VehicleCount = m.VehicleCount, BaseVehicleCount = m.BaseVehicleCount, ModelCount = m.ModelCount }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = m.Comment }; var attachments = SetUpAttachmentsModels(m.Attachments); var changeRequestId = await _vehicleTypeApplicationService.UpdateAsync(type, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(VehicleTypeInputModel model) { if (model == null) { return(BadRequest(ErrorMessage.Type.RequiredTypeInputModel)); } if (model.Name == null) { return(BadRequest(ErrorMessage.Type.RequiredType)); } VehicleType type = new VehicleType() { Id = model.Id, Name = model.Name, VehicleTypeGroupId = model.VehicleTypeGroupId }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _vehicleTypeApplicationService.AddAsync(type, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Put(int id, ModelInputModel model) { if (id == default(int)) { return(BadRequest(ErrorMessage.Model.InvalidModelId)); } if (model == null) { return(BadRequest(ErrorMessage.Model.RequiredModelInputModel)); } if (string.IsNullOrWhiteSpace(model.Name)) { return(BadRequest(ErrorMessage.Model.RequiredModelName)); } //Create Model and Comments Model _model = new Model() { Id = model.Id, Name = model.Name, VehicleTypeId = model.VehicleTypeId, BaseVehicleCount = model.BaseVehicleCount, VehicleCount = model.VehicleCount }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _modelApplicationService.UpdateAsync(_model, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Replace(int id, BaseVehicleInputModel replaceBaseVehicle) { BaseVehicle baseVehicle = new BaseVehicle() { Id = replaceBaseVehicle.Id, MakeId = replaceBaseVehicle.MakeId, ModelId = replaceBaseVehicle.ModelId, YearId = replaceBaseVehicle.YearId, Vehicles = replaceBaseVehicle.vehicles.Select(item => new Vehicle { BaseVehicleId = item.BaseVehicleId, Id = item.Id, RegionId = item.RegionId, SubModelId = item.SubModelId, }).ToList(), }; CommentsStagingModel comment = new CommentsStagingModel { Comment = replaceBaseVehicle.Comment }; var attachments = SetUpAttachmentsModels(replaceBaseVehicle.Attachments); var changeRequestId = await _baseVehicleApplicationService.ReplaceAsync(baseVehicle, baseVehicle.Id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(ModelInputModel newModel) { if (newModel == null) { return(BadRequest(ErrorMessage.Model.RequiredModelInputModel)); } if (string.IsNullOrWhiteSpace(newModel.Name)) { return(BadRequest(ErrorMessage.Model.RequiredModelName)); } //Create model and comments Model model = new Model() { Id = newModel.Id, Name = newModel.Name, VehicleTypeId = newModel.VehicleTypeId }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = newModel.Comment }; var attachments = SetUpAttachmentsModels(newModel.Attachments); var changeRequestId = await _modelApplicationService.AddAsync(model, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Replace(int id, BrakeConfigInputModel model) { BrakeConfig brakeConfig = new BrakeConfig() { Id = model.Id, FrontBrakeTypeId = model.FrontBrakeTypeId, RearBrakeTypeId = model.RearBrakeTypeId, BrakeABSId = model.BrakeABSId, BrakeSystemId = model.BrakeSystemId, VehicleToBrakeConfigs = model.VehicleToBrakeConfigs.Select(item => new VehicleToBrakeConfig { BrakeConfigId = item.BrakeConfigId, Id = item.Id, VehicleId = item.VehicleId }).ToList(), }; CommentsStagingModel comment = new CommentsStagingModel { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _brakeConfigApplicationService.ReplaceAsync(brakeConfig, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task<IHttpActionResult> Post(int id, BedTypeInputModel model) { BedType bedType = new BedType() { Id = model.Id, Name = model.Name }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _bedTypeApplicationService.DeleteAsync(bedType, id, CurrentUser.Email, comment, attachments); return Ok(changeRequestId); }
public override async Task <long> SubmitDeleteChangeRequestAsync <TId>(VehicleToWheelBase entity, TId id, string requestedBy, List <ChangeRequestItemStaging> changeRequestItemStagings = null, CommentsStagingModel comment = null, List <AttachmentsModel> attachmentsStaging = null, string changeContent = null) { if (id.Equals(default(TId))) { throw new ArgumentNullException(nameof(id)); } var vehicleToWheelBaseFromDb = await this.FindAsync(id); if (vehicleToWheelBaseFromDb == null) { throw new NoRecordFound("No Vehicle to Wheel Base exist"); } var vehicleToWheelBaseSubmit = new VehicleToWheelBase() { Id = vehicleToWheelBaseFromDb.Id, VehicleId = vehicleToWheelBaseFromDb.VehicleId, WheelBaseId = vehicleToWheelBaseFromDb.WheelBaseId }; changeRequestItemStagings = changeRequestItemStagings ?? new List <ChangeRequestItemStaging>(); // validate no open CR on loopup items await this.ValidateVehicleToWheelBaseLookUpHasNoChangeRequest(vehicleToWheelBaseFromDb); changeRequestItemStagings.Add(new ChangeRequestItemStaging() { ChangeType = ChangeType.Delete, EntityId = vehicleToWheelBaseFromDb.Id.ToString(), CreatedDateTime = DateTime.UtcNow, Entity = typeof(VehicleToWheelBase).Name, Payload = base.Serializer.Serialize(new VehicleToWheelBase { VehicleId = vehicleToWheelBaseFromDb.VehicleId, WheelBaseId = vehicleToWheelBaseFromDb.WheelBaseId, Id = vehicleToWheelBaseFromDb.Id, }) }); changeContent = $"{vehicleToWheelBaseFromDb.Vehicle.BaseVehicle.YearId} / {vehicleToWheelBaseFromDb.Vehicle.BaseVehicle.Make.Name} / {vehicleToWheelBaseFromDb.Vehicle.BaseVehicle.Model.Name} / {vehicleToWheelBaseFromDb.Vehicle.SubModel.Name} / {vehicleToWheelBaseFromDb.Vehicle.Region.Name} => \n{vehicleToWheelBaseFromDb.WheelBase.Base} / {vehicleToWheelBaseFromDb.WheelBase.WheelBaseMetric}"; var changeRequestId = await base.SubmitDeleteChangeRequestAsync(vehicleToWheelBaseSubmit, id, requestedBy, changeRequestItemStagings, comment, attachmentsStaging, changeContent); vehicleToWheelBaseFromDb.ChangeRequestId = changeRequestId; _vehicleToWheelBaseRepositoryService.Update(vehicleToWheelBaseFromDb); Repositories.SaveChanges(); // todo: needs indexing service await _vehicleToWheelBaseIndexingService.UpdateVehicleToWheelBaseChangeRequestIdAsync(vehicleToWheelBaseFromDb.Id.ToString(), changeRequestId); return(changeRequestId); }
public async Task <IHttpActionResult> Post(int id, VehicleToBedConfigInputModel vehicleToBedConfigInputModel) { CommentsStagingModel comment = new CommentsStagingModel() { Comment = vehicleToBedConfigInputModel.Comment }; var attachments = SetUpAttachmentsModels(vehicleToBedConfigInputModel.Attachments); var changeRequestId = await _vehicleToBedConfigApplicationService.DeleteAsync(null, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(int id, YearInputModel yearInputModel) { // create make and list of comments CommentsStagingModel comment = new CommentsStagingModel() { Comment = yearInputModel.Comment }; var attachments = SetUpAttachmentsModels(yearInputModel.Attachments); var changeRequestId = await _yearApplicationService.DeleteAsync(null, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
protected CommentsStaging MakeCommentsStaging(CommentsStagingModel comment, String addedBy) { // make change request comments staging. CommentsStaging changeRequestCommentsStaging = new CommentsStaging() { Id = 0, Comment = comment.Comment, AddedBy = addedBy, CreatedDatetime = DateTime.UtcNow }; return(changeRequestCommentsStaging); }
public async Task <IHttpActionResult> Post(int id, ModelInputModel modelInputModel) { //System.Threading.Thread.Sleep(2000); //return Ok(-1); // create model and list of comments CommentsStagingModel comment = new CommentsStagingModel() { Comment = modelInputModel.Comment }; var attachments = SetUpAttachmentsModels(modelInputModel.Attachments); var changeRequestId = await _modelApplicationService.DeleteAsync(null, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(int id, WheelBaseInputModel model) { WheelBase wheelBaselength = new WheelBase() { Id = model.Id, Base = model.Base, WheelBaseMetric = model.WheelBaseMetric }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _wheelBaseApplicationService.DeleteAsync(wheelBaselength, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(BedLengthInputModel model) { BedLength bedLength = new BedLength() { Id = model.Id, Length = model.Length, BedLengthMetric = model.BedLengthMetric }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _bedLengthApplicationService.AddAsync(bedLength, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(int id, BrakeSystemInputModel model) { BrakeSystem brakeSystem = new BrakeSystem() { Id = model.Id, Name = model.Name }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _brakeSystemApplicationService.DeleteAsync(brakeSystem, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(int id, EngineDesignationInputModel model) { EngineDesignation engineDesignation = new EngineDesignation() { Id = model.Id, EngineDesignationName = model.EngineDesignationName }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _engineDesignationApplicationService.DeleteAsync(engineDesignation, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(int id, BodyNumDoorsInputModel model) { BodyNumDoors bodyNumDoors = new BodyNumDoors() { Id = model.Id, NumDoors = model.NumDoors }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _bodyNumDoorsApplicationService.DeleteAsync(bodyNumDoors, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(int id, VehicleInputModel model) { Vehicle vehicle = new Vehicle() { Id = model.Id, VehicleToBrakeConfigCount = model.VehicleToBrakeConfigCount }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _vehicleApplicationService.DeleteAsync(vehicle, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task<IHttpActionResult> Put(int id, BedTypeInputModel bedTypeInputModel) { BedType bedType = new BedType() { Id = bedTypeInputModel.Id, Name = bedTypeInputModel.Name, BedConfigCount = bedTypeInputModel.BedConfigCount, VehicleToBedConfigCount = bedTypeInputModel.VehicleToBedConfigCount }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = bedTypeInputModel.Comment }; var attachments = SetUpAttachmentsModels(bedTypeInputModel.Attachments); var changeRequestId = await _bedTypeApplicationService.UpdateAsync(bedType, bedType.Id, CurrentUser.Email, comment, attachments); return Ok(changeRequestId); }
public async Task <IHttpActionResult> Post(BodyTypeInputModel model) { // create body type and list of comments BodyType bodyType = new BodyType() { Id = model.Id, Name = model.Name }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _bodyTypeApplicationService.AddAsync(bodyType, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(MfrBodyCodeInputModel model) { MfrBodyCode mfrBodyCode = new MfrBodyCode() { Id = model.Id, Name = model.Name }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _mfrBodyCodeApplicationService.AddAsync(mfrBodyCode, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(int id, MfrBodyCodeInputModel model) { MfrBodyCode mfrBodyCode = new MfrBodyCode() { Id = model.Id, VehicleToMfrBodyCodeCount = model.VehicleToMfrBodyCodeCount }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment, }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _mfrBodyCodeApplicationService.DeleteAsync(mfrBodyCode, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(int id, BodyStyleConfigInputModel model) { BodyStyleConfig bodyStyleConfig = new BodyStyleConfig() { Id = model.Id, VehicleToBodyStyleConfigCount = model.VehicleToBodyStyleConfigCount }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment, }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _bodyStyleConfigApplicationService.DeleteAsync(bodyStyleConfig, 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> Post(VehicleToBedConfigInputModel model) { CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _vehicleToBedConfigApplicationService.AddAsync(new VehicleToBedConfig() { Id = model.Id, BedConfigId = model.BedConfig.Id, VehicleId = model.Vehicle.Id }, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(SubModelInputModel newSubModel) { SubModel subModel = new SubModel() { Id = newSubModel.Id, Name = newSubModel.Name }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = newSubModel.Comment }; var attachments = SetUpAttachmentsModels(newSubModel.Attachments); var changeRequestId = await _subModelApplicationService.AddAsync(subModel, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(EngineVinInputModel model) { // create bed type and list of comments EngineVin EngineVin = new EngineVin() { Id = model.Id, EngineVinName = model.EngineVinName }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = model.Comment }; var attachments = SetUpAttachmentsModels(model.Attachments); var changeRequestId = await _EngineVinApplicationService.AddAsync(EngineVin, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public virtual async Task <long> SubmitAddChangeRequestAsync(T entity, string requestedBy, List <ChangeRequestItemStaging> changeRequestItemStagings = null, CommentsStagingModel comment = null, List <AttachmentsModel> attachments = null, string changeContent = null) { // make change request comments stagings. CommentsStaging changeRequestCommentsStaging = null; if (comment != null) { changeRequestCommentsStaging = this.MakeCommentsStaging(comment, requestedBy); } return (await ChangeRequestBusinessService.SubmitAsync(entity, 0, requestedBy, ChangeType.Add, changeRequestItemStagings, changeRequestCommentsStaging, MakeAttachmentsStaging(attachments, requestedBy), changeContent)); }
public async Task <IHttpActionResult> Post(int id, SubModelInputModel deleteSubModel) { SubModel subModel = new SubModel() { Id = deleteSubModel.Id }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = deleteSubModel.Comment }; var attachments = SetUpAttachmentsModels(deleteSubModel.Attachments); var changeRequestId = await _subModelApplicationService.DeleteAsync(subModel, id, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }
public async Task <IHttpActionResult> Post(FuelDeliveryTypeInputModel fuelDeliveryTypeInputModel) { // create fuelDeliveryType and list of comments FuelDeliveryType fuelDeliveryType = new FuelDeliveryType() { Id = fuelDeliveryTypeInputModel.Id, FuelDeliveryTypeName = fuelDeliveryTypeInputModel.Name }; CommentsStagingModel comment = new CommentsStagingModel() { Comment = fuelDeliveryTypeInputModel.Comment }; var attachments = SetUpAttachmentsModels(fuelDeliveryTypeInputModel.Attachments); var changeRequestId = await _fuelDeliveryTypeApplicationService.AddAsync(fuelDeliveryType, CurrentUser.Email, comment, attachments); return(Ok(changeRequestId)); }