public ListContainer <Document> Get(int page, int size, string term) { var result = String.IsNullOrEmpty(term) ? _documentsRepository.Get((page - 1) * size, size) : _documentsRepository.GetByTerm((page - 1) * size, size, term); return(result); }
public HttpResponseMessage Editor([ModelBinder] Session session, Guid id) { var document = documentsRepository.Get(id); if (document == null) { return(new RedirectResult("/")); } var model = new EditorModel { UserId = session.UserId, DocumentId = id }; return(new RazorViewResult(razorEngineService, session, "Main.Editor.cshtml", model)); }
public object GetAll() { var queryValues = Request.RequestUri.ParseQueryString(); int page = Convert.ToInt32(queryValues["page"]); int start = Convert.ToInt32(queryValues["start"]); int limit = Convert.ToInt32(queryValues["limit"]); int id = Convert.ToInt32(queryValues["id"]); int orden = Convert.ToInt32(queryValues["orden"]); int qHeaderId = Convert.ToInt32(queryValues["QHeaderId"]); int vendorId = Convert.ToInt32(queryValues["VendorId"]); int vendorQuoteId = Convert.ToInt32(queryValues["VendorQuoteId"]); #region Configuramos el orden de la consulta si se obtuvo como parametro string strOrder = !string.IsNullOrWhiteSpace(queryValues["sort"]) ? queryValues["sort"] : ""; strOrder = strOrder.Replace('[', ' '); strOrder = strOrder.Replace(']', ' '); Sort sort; if (!string.IsNullOrWhiteSpace(strOrder)) { sort = JsonConvert.DeserializeObject <Sort>(strOrder); } else { sort = new Sort(); } #endregion string query = !string.IsNullOrWhiteSpace(queryValues["query"]) ? queryValues["query"] : ""; int totalRecords = 0; try { if (id == 0) { object json; string msgError = ""; IList <Document> lista; lista = repository.GetList(vendorQuoteId, vendorId, qHeaderId, query, sort, page, start, limit, ref totalRecords, ref msgError); json = new { total = totalRecords, data = lista, success = true }; return(json); } else { string msgError = ""; Document estatus = repository.Get(id, ref msgError); object json = new { data = estatus, success = true, message = msgError }; return(json); } } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); object error = new { message = ex.Message }; object json = new { message = ex.Message, success = false }; return(json); } }
public Documents Get(Int64 ixDocument) => _documentsRepository.Get(ixDocument);
public IDocumentSession GetOrLoad(Guid documentId) { return(documents.GetOrAdd(documentId, id => documentSessionFactory(documentsRepository.Get(id).Content))); }