Пример #1
0
 public IActionResult Put(int id, [FromBody] Form form)
 {
     if (ModelState.IsValid)
     {
         _formManager.UpdateForm(id, form);
         return(this.Ok(form));
     }
     else
     {
         return(this.StatusCode(StatusCodes.Status422UnprocessableEntity));
     }
 }
Пример #2
0
        private Tuple <IotLinkType, int> UpdateIot(IotLink link)
        {
            IotLinkType iotLinkType;
            int         replyId;

            if (link.Form == null)
            {
                iotLinkType = IotLinkType.Ideation;
                replyId     = link.IdeationReply.IdeationReplyId;
            }
            else
            {
                iotLinkType = IotLinkType.Form;
                replyId     = link.Form.FormId;
            }

            switch (iotLinkType)
            {
            case IotLinkType.Ideation:
                _ideationManager.UpdateReply(link.IdeationReply);
                break;

            case IotLinkType.Form:
                _formManager.UpdateForm(link.Form);
                break;
            }

            try
            {
                _unitOfWorkManager.FixUnchangedEntries(); // only used one time where 2 dbcontexts were unavoidable -> UI.MVC/scheduler
                _unitOfWorkManager.Save();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(new Tuple <IotLinkType, int>(iotLinkType, replyId));
        }