public ActionResult Create(int? id) { var userName = System.Web.HttpContext.Current.User.Identity.Name; var user = _systemService.GetUserAndRole(0, userName); if (user == null) { return RedirectToAction("Index", "Login"); } if (user.StoreR == 0) { return RedirectToAction("Index", "Home"); } var item = new Store(); if (id.HasValue) { item = _service.GetByKey(id.Value); } var model = new StoreViewModel { Id = item.Id, Code = item.Code, Name = item.Name, CountryId = item.CountryId, Address = item.Address, Tel = item.Tel, Phone = item.Phone, Description = item.Description, Timestamp = item.Timestamp, iCreated = item.iCreated, dCreated = item.dCreated, UserLogin = user, Countries = new SelectList(_systemService.CountryList(), "Id", "Name") }; // FUNCTION return View(model); }
public bool Update(Store store) { _repository.Update(store); _unitOfWork.CommitChanges(); return true; }
public bool Insert(Store store) { _repository.Add(store); _unitOfWork.CommitChanges(); return true; }