Exemplo n.º 1
0
        public ActionResult EditCustomer(int?customerId, int?locationId)
        {
            var itemsBags = _caseSizeRepository.FindAll(x => x.CaseTypeId == 1).Select(x => new CaseSize()
            {
                Name = x.Name,
                Id   = x.Id
            }).ToList();

            ViewBag.Bags = itemsBags;
            var itemsBoxes = _caseSizeRepository.FindAll(x => x.CaseTypeId == 2).Select(x => new CaseSize()
            {
                Name = x.Name,
                Id   = x.Id
            }).ToList();

            ViewBag.Boxes = itemsBoxes;
            FillLookups();
            if (customerId != null)
            {
                return(UpdateView(customerId.Value));
            }
            if (locationId != null)
            {
                var customerViewModel = SessionService.Get().CustomerViewModel;
                customerViewModel.CurrentEditLocation = customerViewModel.CustomerLocations.FirstOrDefault(l => l.LocationId == locationId);
                return(View("Edit", customerViewModel));
            }
            return(View("Edit"));
        }
Exemplo n.º 2
0
 private IEnumerable <ProductTypeItem> GetCases(int caseType, OmsCustomerType?customerTypeId, bool isBoth)
 {
     if (isBoth || customerTypeId == null)
     {
         return(_caseSizeRepository.FindAll(
                    x => x.IsActive).Select(x => new ProductTypeItem
         {
             TypeId = x.Id,
             TypeName = x.Name,
         }).ToList());
     }
     else if (customerTypeId != null)
     {
         return(_caseSizeRepository.FindAll(
                    x => x.IsActive && x.CaseTypeId == caseType && x.CustomerTypeId == (OmsCustomerType)customerTypeId)
                .Select(x => new ProductTypeItem
         {
             TypeId = x.Id,
             TypeName = x.Name,
         }).ToList());
     }
     return(new List <ProductTypeItem>());
 }