Exemplo n.º 1
0
 public IHttpActionResult Post([FromBody] MarginModel marginModel)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         MarginBusinessLogic.AddMargin(marginModel.ToEntity());
         return(Ok(marginModel));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        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));
            }
        }
Exemplo n.º 3
0
        public IHttpActionResult Put([FromUri] Guid id, [FromBody] MarginModel marginModel)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                marginModel.Id = id;

                MarginBusinessLogic.ModifyMargin(marginModel.ToEntity());
                AuditLogBussinesLogic.CreateLog("Document", marginModel.DocumentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);

                return(Ok(marginModel));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }