Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> Put(int id, SubModelInputModel updateSubModel)
        {
            SubModel subModel = new SubModel()
            {
                Id           = updateSubModel.Id,
                Name         = updateSubModel.Name,
                VehicleCount = updateSubModel.VehicleCount
            };

            CommentsStagingModel comment = new CommentsStagingModel()
            {
                Comment = updateSubModel.Comment
            };

            var attachments = SetUpAttachmentsModels(updateSubModel.Attachments);

            var changeRequestId = await _subModelApplicationService.UpdateAsync(subModel, id, CurrentUser.Email, comment, attachments);

            return(Ok(changeRequestId));
        }