Пример #1
0
        public ActionResult Index(MedicalVendorListModelFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;
            var model = _organizationService.GetMedicalVendorlistModel(pageNumber, _pageSize, filter, out totalRecords);

            if (model == null)
            {
                model = new MedicalVendorListModel();
            }
            model.Filter = filter;

            var currentAction          = ControllerContext.RouteData.Values["action"].ToString();
            Func <int, string> urlFunc = pn => Url.Action(currentAction, new { pageNumber = pn, filter.Name });

            model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);

            return(View(model));
        }
        public MedicalVendorListModel Create(IEnumerable <MedicalVendor> medicalVendors, OrganizationListModel orgListModel, IEnumerable <OrderedPair <long, string> > contracts)
        {
            var model       = new MedicalVendorListModel();
            var basicModels = new MedicalVendorModel[medicalVendors.Count()];
            var index       = 0;

            foreach (var medicalVendor in medicalVendors)
            {
                basicModels[index++] = new MedicalVendorModel()
                {
                    Contract =
                        contracts.Where(c => c.FirstValue == medicalVendor.Id).Select(
                            c => c.SecondValue).FirstOrDefault(),
                    MedicalVendorType          = medicalVendor.MedicalVendorType,
                    OrganizationBasicInfoModel =
                        orgListModel.Organizations.Where(o => o.Id == medicalVendor.Id).
                        FirstOrDefault()
                };
            }
            model.MedicalVendors = basicModels;
            return(model);
        }