public bool DeleteStore(Store store) { if (store == null) return false; _unitOfWork.StoreRepository.Delete(store); _unitOfWork.Save(); return true; }
public void CanDoPostBackEdit() { //ACT var store = new Store { Name = "Store 4", HubID = 2, IsActive = true, IsTemporary = false, Number = 101, StackCount = 1, StoreManName = "Mezgebu" }; var result = _storeController.Edit(store); //Assert Assert.IsInstanceOf<ActionResult>(result); Assert.IsInstanceOf<int>(store.StoreID); }
public virtual ActionResult Create(Store store) { if (ModelState.IsValid) { _storService.AddStore(store); return Json(new { success = true }); } UserProfile user = _userProfileService.GetUser(User.Identity.Name); ViewBag.HubID = new SelectList(user.UserAllowedHubs.OrderBy(p => p.Name), "HubID", "HubNameWithOwner"); return PartialView(store); }
public bool EditStore(Store store) { _unitOfWork.StoreRepository.Edit(store); _unitOfWork.Save(); return true; }
public bool AddStore(Store store) { _unitOfWork.StoreRepository.Add(store); _unitOfWork.Save(); return true; }
// // GET: /Store/Edit/5 public virtual ActionResult Edit(int id) { UserProfile user = _userProfileService.GetUser(User.Identity.Name); var stores = _storService.GetAllByHUbs(user.UserAllowedHubs); Store store = stores.Find(p => p.StoreID == id);//only look inside the allowed stores if (store != null){ ViewBag.HubID = new SelectList(user.UserAllowedHubs.OrderBy(p => p.Name), "HubID", "HubNameWithOwner", store.HubID); } else { store = new Store(); ViewBag.HubID = new SelectList(Enumerable.Empty<SelectListItem>()); } return PartialView(store); }
private Store BindStore(StoreViewModel model) { if (model == null) return null; var store = new Store() { StoreID = model.StoreID, Number = model.Number, Name = model.Name, HubID = model.HubID, IsActive = model.IsActive, IsTemporary = model.IsTemporary, StackCount = model.StackCount, StoreManName = model.StoreManName }; return store; }