Example #1
0
        public IActionResult Create()
        {
            var viewModel = new WaitableListViewModel
            {
                TypeList     = new SelectList(_medicalBillsTypeService.GetAll().ToList()),
                FormList     = new SelectList(_formService.GetAll().ToList()),
                MedicalBills = new SelectList(_medicalBillsService.GetAll())
            };

            return(View(viewModel));
        }
Example #2
0
 public IActionResult Create(WaitableListViewModel waitableList)
 {
     if (ModelState.IsValid)
     {
         var list = new WaitableListDTO
         {
             DateOfManufacture = waitableList.DateOfManufacture,
             ShelfLife         = waitableList.ShelfLife,
             MedicalBills      = _medicalBillsService.GetAll().FirstOrDefault(u => u.Name == waitableList.Name)
         };
         _waitableListService.Add(list);
         return(RedirectToAction("List"));
     }
     return(View());
 }
Example #3
0
        public IActionResult List()
        {
            List <WaitableListViewModel> waitableListViewModels = new List <WaitableListViewModel>();
            var store = _waitableListService.GetAll();

            foreach (WaitableListDTO un in store)
            {
                if (!waitableListViewModels.Select(u => u.Name).Contains(un.MedicalBills.Name))
                {
                    WaitableListViewModel model = new WaitableListViewModel
                    {
                        Id       = un.Id,
                        Name     = un.MedicalBills.Name,
                        Type     = un.MedicalBills.MedicalBillsType.Type,
                        Form     = un.MedicalBills.Form.FormName,
                        Quantity = store.Where(u => u.MedicalBills.Id == un.MedicalBills.Id).Count()
                    };
                    waitableListViewModels.Add(model);
                }
            }

            return(View(waitableListViewModels));
        }