Beispiel #1
0
        public async Task <IEnumerable <DocumentDetailDTO> > GetDocsByConditions(SearchConditionsDTO model)
        {
            try
            {
                List <DocumentDetailDTO> lstDocs = (await GetDocsByFolderId(model.docfolder)).ToList();

                if (!string.IsNullOrEmpty(model.stage))
                {
                    lstDocs = lstDocs.Where(x => x.stage == model.stage).ToList();
                }
                if (!string.IsNullOrEmpty(model.doctype))
                {
                    lstDocs = lstDocs.Where(x => x.document_extension.Contains(model.doctype)).ToList();
                }
                if (!string.IsNullOrEmpty(model.docagency))
                {
                    lstDocs = lstDocs.Where(x => x.document_agency.Contains(model.docagency)).ToList();
                }
                if (model.status != "All")
                {
                    lstDocs = lstDocs.Where(x => x.status.Contains(model.status)).ToList();
                }

                return(lstDocs.OrderByDescending(x => x.created_date).ThenByDescending(x => x.id));
            }
            catch (Exception e)
            {
                throw;
            }
        }
Beispiel #2
0
        public async Task <JsonResult> SearchByConditions([FromBody] SearchConditionsDTO model)
        {
            try
            {
                System.Security.Claims.ClaimsPrincipal currentUser = this.User;
                var role     = currentUser.Claims.Where(x => x.Type == System.Security.Claims.ClaimTypes.Role).Select(x => x.Value);
                var listDocs = await _documentService.GetDocsByConditions(model);

                return(Json(new { status = "success", message = "success !", listDocs, role }));
            }
            catch (Exception e)
            {
                return(Json(new { status = "fail", message = e }));
            }
        }