예제 #1
0
        public async Task <ActionResult> Create(ProductModel model)
        {
            try
            {
                var entity = new Product();

                Uow.ProductRepository.Add(entity);

                await Uow.CommitChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #2
0
        public async Task <ActionResult> Edit(Int32 id, OrderModel model)
        {
            try
            {
                var entity = await Task.Run(() =>
                {
                    return(Uow.OrderRepository.Get(new Order(id)));
                });

                await Uow.CommitChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #3
0
        public async Task <ActionResult> Create(ShipperModel model)
        {
            try
            {
                var entity = new Shipper();

                entity.CompanyName = model.CompanyName;
                entity.Phone       = model.Phone;

                Uow.ShipperRepository.Add(entity);

                await Uow.CommitChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #4
0
        public async Task <ActionResult> Create(CategoryModel model)
        {
            try
            {
                var entity = new Category();

                entity.CategoryName = model.CategoryName;
                entity.Description  = model.Description;

                Uow.CategoryRepository.Add(entity);

                await Uow.CommitChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #5
0
        public async Task <ActionResult> Create(RegionModel model)
        {
            try
            {
                var entity = new EL.Region();

                entity.RegionID          = model.RegionID;
                entity.RegionDescription = model.RegionDescription.Trim();

                Uow.RegionRepository.Add(entity);

                await Uow.CommitChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #6
0
        public async Task AddCustomer(Customer entity)
        {
            Uow.CustomerRepository.Add(entity);

            await Uow.CommitChangesAsync();
        }