コード例 #1
0
 public IHttpActionResult Delete([FromUri] Guid id)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         DocumentBusinessLogic.DeleteDocument(id);
         AuditLogBussinesLogic.CreateLog("Document", id, Utils.GetUsername(Request), ActionPerformed.DELETE);
         return(Ok("Document deleted"));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #2
0
        public IHttpActionResult Post([FromBody] DocumentModel documentModel)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
                documentModel.CreatorUser = Utils.GetCreatorUser(Request, UserBusinessLogic);

                DocumentBusinessLogic.AddDocument(documentModel.ToEntity());
                AuditLogBussinesLogic.CreateLog("Document", documentModel.Id, Utils.GetUsername(Request), ActionPerformed.CREATE);
                return(Ok(documentModel));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #3
0
        public IHttpActionResult Put([FromUri] Guid id, [FromBody] DocumentModel documentModel)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                documentModel.Id = id;

                DocumentBusinessLogic.ModifyDocument(documentModel.ToEntity());
                AuditLogBussinesLogic.CreateLog("Document", documentModel.Id, Utils.GetUsername(Request), ActionPerformed.MODIFY);
                return(Ok("Document Modified"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #4
0
        public IHttpActionResult Post([FromUri] Guid documentId, [FromUri] int index, [FromBody] ParagraphModel documentPart)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                var paragraph = documentPart.ToEntity();
                DocumentBusinessLogic.AddDocumentParagraphAt(documentId, index, paragraph);

                AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);
                return(Ok(documentPart));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #5
0
        public IHttpActionResult Post([FromUri] Guid documentId, [FromUri] MarginAlign align, [FromBody] MarginModel documentPart)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                var body = documentPart.ToEntity();
                DocumentBusinessLogic.SetDocumentMargin(documentId, align, body);

                AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);
                return(Ok(documentPart));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }