Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> Post(int id, BrakeConfigInputModel model)
        {
            BrakeConfig brakeConfig = new BrakeConfig()
            {
                Id = model.Id,
                VehicleToBrakeConfigCount = model.VehicleToBrakeConfigCount
            };
            CommentsStagingModel comment = new CommentsStagingModel()
            {
                Comment = model.Comment,
            };
            var attachments     = SetUpAttachmentsModels(model.Attachments);
            var changeRequestId = await _brakeConfigApplicationService.DeleteAsync(brakeConfig, id, CurrentUser.Email, comment, attachments);

            return(Ok(changeRequestId));
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> Post(BrakeConfigInputModel model)
        {
            BrakeConfig brakeConfig = new BrakeConfig()
            {
                Id = model.Id,
                FrontBrakeTypeId = model.FrontBrakeTypeId,
                RearBrakeTypeId  = model.RearBrakeTypeId,
                BrakeABSId       = model.BrakeABSId,
                BrakeSystemId    = model.BrakeSystemId
            };
            CommentsStagingModel comment = new CommentsStagingModel()
            {
                Comment = model.Comment
            };
            var attachments     = SetUpAttachmentsModels(model.Attachments);
            var changeRequestId = await _brakeConfigApplicationService.AddAsync(brakeConfig, CurrentUser.Email, comment, attachments);

            return(Ok(changeRequestId));
        }