Пример #1
0
 public IHttpActionResult Post([FromBody] TextModel textModel)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         TextBusinessLogic.AddText(textModel.ToEntity());
         return(Ok(textModel));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Пример #2
0
        public IHttpActionResult Put([FromUri] Guid marginId, [FromBody] TextModel textModel)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
                var  text       = TextModel.ToEntity(textModel);
                Guid documentId = MarginBusinessLogic.GetMargin(marginId).DocumentId.Value;
                MarginBusinessLogic.SetText(marginId, text);
                AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);

                return(Ok(textModel));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Пример #3
0
        public IHttpActionResult Post([FromUri] Guid paragraphId, [FromBody] TextModel textModel, [FromUri] int position)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
                var  text       = TextModel.ToEntity(textModel);
                Guid documentId = ParagraphBusinessLogic.GetParagraph(paragraphId).DocumentId.Value;
                ParagraphBusinessLogic.PutTextAt(paragraphId, text, position);
                AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);

                return(Ok("Text deleted"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Пример #4
0
        public IHttpActionResult Put([FromUri] Guid id, [FromBody] TextModel textModel)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                textModel.Id = id;

                TextBusinessLogic.ModifyText(textModel.ToEntity());
                Guid?documentId = TextBusinessLogic.GetDocumentId(id);
                AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);
                return(Ok("Text Modified"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }