public IHttpActionResult Create([FromBody] SynthesisRequestModel model)
 {
     try
     {
         var synthesisRequest = new SynthesisRequest();
         Mapper.Map(model, synthesisRequest);
         _synthesisRequestsService.CreateSynthesisRequest(synthesisRequest);
         model.Id       = synthesisRequest.Id;
         model.StatusId = synthesisRequest.StatusId;
         return(Ok(model));
     }
     catch (DbEntityValidationException ex)
     {
         foreach (var entityValidationErrors in ex.EntityValidationErrors)
         {
             foreach (var validationError in entityValidationErrors.ValidationErrors)
             {
                 model.SetError(validationError.PropertyName, validationError.ErrorMessage);
             }
         }
         return(Ok(model));
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
        public IHttpActionResult Update([FromUri] int id, [FromBody] SynthesisRequestModel model)
        {
            try
            {
                var synthesisRequest = _synthesisRequestsService.GetSynthesisRequest(id);
                if (synthesisRequest == null)
                {
                    return(NotFound());
                }

                synthesisRequest.SynthesisRequestStrands.Clear();
                synthesisRequest.MaterialRequests.Clear();
                Mapper.Map(model, synthesisRequest);
                if (_synthesisRequestsService.IsStatusExists(model.StatusId))
                {
                    synthesisRequest.StatusId = model.StatusId;
                }

                _synthesisRequestsService.UpdateSynthesisRequest(synthesisRequest);
                return(Ok(model));
            }
            catch (DbEntityValidationException ex)
            {
                foreach (var entityValidationErrors in ex.EntityValidationErrors)
                {
                    foreach (var validationError in entityValidationErrors.ValidationErrors)
                    {
                        model.SetError(validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
                return(Ok(model));
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }