public IHttpActionResult Delete([FromUri] Guid id) { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); Guid?documentId = TextBusinessLogic.GetDocumentId(id); TextBusinessLogic.DeleteText(id); AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY); return(Ok("Text deleted")); } catch (Exception e) { return(BadRequest(e.Message)); } }
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)); } }