//read public AttachmentItemPagedList GetAllAttachmentItems(AttachmentItemSearchModel searchModel) { if (!_authorization.Read(new AttachmentKeyModel { EntityName = searchModel.EntityName, FieldName = searchModel.FieldName, EntityId = searchModel.EntityId })) { throw new UnauthorizedAccessException(); } return(_business.GetAllAttachmentItems(searchModel)); }
public ActionResult GetAllAttachmentItems(AttachmentItemSearchModel searchModel) { try { var result = attachmentBusiness.GetAllAttachmentItems(searchModel);//check read permission if (result == null) { return(NotFound()); } return(Ok(result)); } catch (Exception) { return(BadRequest()); } }