Esempio n. 1
0
        public async Task <IHttpActionResult> Post(YearInputModel yearInputModel)
        {
            if (yearInputModel == null)
            {
                return(BadRequest(ErrorMessage.Year.RequiredYearInputModel));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            //check length
            if (yearInputModel.Id.ToString().Length != 4)
            {
                ModelState.AddModelError("", ErrorMessage.Year.InvalidYearLength);
                return(BadRequest(ModelState));
            }
            Year year = new Year()
            {
                Id = yearInputModel.Id
            };
            //var year = Mapper.Map<Year>(yearInputModel);
            var changeRequestId = await _yearApplicationService.AddAsync(year, CurrentUser.Email);

            return(Ok(changeRequestId));
        }
Esempio n. 2
0
        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));
        }