Esempio n. 1
0
        public ActionResult ListForCurrentUser()
        {
            ListForCurrentUserViewModel model = new ListForCurrentUserViewModel();

            model.Filter      = new ListForCurrentUserFilterViewModel();
            model.CurrentPage = 1;
            model.PageSize    = 10;
            NeedForBloodSearchFilter searchFilter = new NeedForBloodSearchFilter();

            searchFilter.CurrentPage         = model.CurrentPage.HasValue ? model.CurrentPage.Value : 1;
            searchFilter.PageSize            = model.PageSize.HasValue ? model.PageSize.Value : 10;
            searchFilter.SortOn              = model.SortOn;
            searchFilter.SortDirection       = model.SortDirection;
            searchFilter.Filter_BloodGroupId = model.Filter.Filter_BloodGroupId;
            model.Filter.Filter_IsFound      = 0;//default
            searchFilter.Filter_IsFound      = model.Filter.Filter_IsFound;
            searchFilter.Filter_HospitalId   = SessionHelper.CurrentUser.HospitalId;

            model.FilterBloodGroupSelectList = GetBloodGroupSelectList();
            model.FilterIsFoundSelectList    = GetIsFoundSelectList();

            try
            {
                model.DataList = _needForBloodService.GetAllPaginatedWithDetailBySearchFilter(searchFilter);
            }
            catch
            {
                model.DataList       = new PaginatedList <NeedForBloodWithDetail>(new List <NeedForBloodWithDetail>(), 0, searchFilter.CurrentPage, searchFilter.PageSize, searchFilter.SortOn, searchFilter.SortDirection);
                ViewBag.ErrorMessage = "Error";
            }
            return(View(model));
        }
Esempio n. 2
0
        public ActionResult ListForCurrentUser(ListForCurrentUserViewModel model)
        {
            // filter bilgilerinin default boş değerlerle doldurulması sağlanıyor
            if (model.Filter == null)
            {
                model.Filter = new ListForCurrentUserFilterViewModel();
            }

            if (!model.CurrentPage.HasValue)
            {
                model.CurrentPage = 1;
            }

            if (!model.PageSize.HasValue)
            {
                model.PageSize = 10;
            }

            NeedForBloodSearchFilter searchFilter = new NeedForBloodSearchFilter();

            searchFilter.CurrentPage         = model.CurrentPage.HasValue ? model.CurrentPage.Value : 1;
            searchFilter.PageSize            = model.PageSize.HasValue ? model.PageSize.Value : 10;
            searchFilter.SortOn              = model.SortOn;
            searchFilter.SortDirection       = model.SortDirection;
            searchFilter.Filter_BloodGroupId = model.Filter.Filter_BloodGroupId;
            searchFilter.Filter_IsFound      = model.Filter.Filter_IsFound;
            searchFilter.Filter_HospitalId   = SessionHelper.CurrentUser.HospitalId;
            model.FilterBloodGroupSelectList = GetBloodGroupSelectList();
            model.FilterIsFoundSelectList    = GetIsFoundSelectList();

            try
            {
                model.DataList = _needForBloodService.GetAllPaginatedWithDetailBySearchFilter(searchFilter);
            }
            catch
            {
                model.DataList       = new PaginatedList <NeedForBloodWithDetail>(new List <NeedForBloodWithDetail>(), 0, searchFilter.CurrentPage, searchFilter.PageSize, searchFilter.SortOn, searchFilter.SortDirection);
                ViewBag.ErrorMessage = "Error";
            }
            return(View(model));
        }