Exemplo n.º 1
0
        public ActionResult Create(Customer customer)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Lib.Location libStore = StoreRepo.GetAllStores().First();
                    CustomerRepo.AddCustomer(new Lib.Customer
                    {
                        FirstName = customer.FirstName,
                        LastName  = customer.LastName,
                        Birthday  = customer.Birthday,
                        StoreId   = libStore.LocationId
                    });
                    CustomerRepo.Save();



                    return(RedirectToAction(nameof(Index)));
                }
                return(View(customer));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 2
0
        // GET: Store/Delete/5
        public ActionResult Delete(int id)
        {
            Lib.Location libStore = StoreRepo.GetStoreById(id);
            var          webStore = new Store
            {
                Id   = libStore.LocationId,
                Name = libStore.Name,
            };

            return(View(libStore));
        }
Exemplo n.º 3
0
        // GET: Store/Details/5
        public ActionResult Details(int id)
        {
            Lib.Location libStore = StoreRepo.GetStoreById(id);

            var webStore = new Store
            {
                Id   = libStore.LocationId,
                Name = libStore.Name,
            };

            StoreViewModel svm = new StoreViewModel(libStore);

            return(View(svm));
        }
Exemplo n.º 4
0
        // GET: Customer/Details/5
        public ActionResult Details(int id)
        {
            Lib.Customer libCustomer = CustomerRepo.GetCustomerById(id);
            Lib.Location libStore    = StoreRepo.GetAllStores().First();
            var          webCust     = new Customer
            {
                Id        = libCustomer.Id,
                FirstName = libCustomer.FirstName,
                LastName  = libCustomer.LastName,
                Birthday  = libCustomer.Birthday,
                StoreId   = libCustomer.StoreId
            };

            CustomerViewModel cvm = new CustomerViewModel(libCustomer, libStore);

            return(View(cvm));
        }