Пример #1
0
        public void Create(SubStoreViewModel subStoreVM)
        {
            var SubStore = new SubStore
            {
                SubStoreName = subStoreVM.SubStoreName,
                StoreId      = subStoreVM.StoreId
            };

            unitOfWork.SubStoreRepository.Insert(SubStore);
            unitOfWork.Save();
        }
        // GET: SubStore/Details/5
        public ActionResult Details(int id = 0)
        {
            if (id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            SubStoreViewModel details = subStoreService.GetById(id);

            if (details == null)
            {
                return(HttpNotFound());
            }
            return(View(details));
        }
        public ActionResult Create(SubStoreViewModel subStoreVM)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    subStoreService.Create(subStoreVM);
                }


                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(SubStoreViewModel subStoreVM)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // TODO: Add update logic here

                    subStoreService.Update(subStoreVM);

                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View());
                }
            }
            return(View());
        }