public PostService(UnitofWork uow) { _uow = uow; _postRepository = uow.GetRepository <Post>(); _userRepository = uow.GetRepository <User>(); _categoryRepository = uow.GetRepository <Category>(); }
// GET: Customer public ActionResult Index() { using (var tx = uow.BeginTransaction()) { var listitem = uow.GetRepository <Customer>().All().ToList(); return(View(listitem)); } }
public ActionResult ListByCat(int id, int page = 1) { using (UnitofWork uow = new UnitofWork()) { return(View(uow.GetRepository <Product>().Listele().Where(x => x.CategoryID == id).ToPagedList(page, 9))); } }
public override void OnAuthorization(AuthorizationContext filterContext) { bool authorized = false; UnitofWork uow = new UnitofWork(); AppUser user = uow.GetRepository <AppUser>().Listele().First(x => x.UserName == HttpContext.Current.User.Identity.Name); string userRole = Enum.GetName(typeof(Role), user.Role); foreach (var role in this.UserProfilesRequired) { if (userRole == role) { authorized = true; break; } } if (!authorized) { var url = new UrlHelper(filterContext.RequestContext); var logonUrl = url.Action("Http", "Error", new { Id = 401, Area = "" }); filterContext.Result = new RedirectResult(logonUrl); } base.OnAuthorization(filterContext); }
public ActionResult Update(int id) { using (UnitofWork uow = new UnitofWork()) { Category c = uow.GetRepository <Category>().GetElementById(id); return(View(c)); } }
public ActionResult Order(Order o) { var odt = Session["od"] as Order_Details; Order_Details od = new Order_Details(); od = odt; od.Order = o; o.Order_Details.Add(od); using (UnitofWork uow = new UnitofWork()) { uow.GetRepository <Order>().Ekle(o); uow.GetRepository <Order_Details>().Ekle(od); uow.SaveChanges(); } Response.Write("<script>alert('Bizi Tercih Ettiğiniz İçin Teşekkür Ederiz')</script>"); return(Redirect("/Home/Index")); }
public ActionResult List() { using (UnitofWork uow = new UnitofWork()) { var list = uow.GetRepository <Category>().Listele(); return(View(list)); } }
public ActionResult Delete(int id) { using (UnitofWork uow = new UnitofWork()) { uow.GetRepository <Category>().Sil(id); uow.SaveChanges(); } return(Redirect("/Admin/Category/List")); }
public ActionResult Update(Category c) { using (UnitofWork uow = new UnitofWork()) { uow.GetRepository <Category>().Guncelle(c); uow.SaveChanges(); } return(Redirect("/Admin/Category/List")); }
public ActionResult Login(AppUser a) { AppUser data = uow.GetRepository <AppUser>().Listele().First(x => x.UserName == a.UserName && x.Password == a.Password); if (data != null) { FormsAuthentication.SetAuthCookie(data.UserName, true); HttpCookie usercookie = new HttpCookie("user", data.UserName.ToString()); usercookie.Expires.AddMinutes(20); Response.Cookies.Add(usercookie); return(Redirect("/Home/Index")); } else { return(Redirect("/Home/Index")); } }
public ActionResult OrderCart(Order o) { List <Order_Details> odlist = Session["odlist"] as List <Order_Details>; foreach (var item in odlist) { item.Order = o; o.Order_Details.Add(item); } using (UnitofWork uow = new UnitofWork()) { foreach (var item in odlist) { uow.GetRepository <Order_Details>().Ekle(item); } uow.GetRepository <Order>().Ekle(o); } Response.Write("<script>alert('Bizi Tercih Ettiğiniz İçin Teşekkür Ederiz')</script>"); return(View("/Home/Index")); }
public JsonResult Search(string a) { using (UnitofWork uow = new UnitofWork()) { var list = uow.GetRepository <Product>().Listele().Where(x => x.ProductName.ToLower().StartsWith(a) || x.ProductName.ToLower().Contains(a)).Select(x => new Product { ID = x.ID, ImagePath = x.ImagePath, ProductName = x.ProductName }); return(Json(list, JsonRequestBehavior.AllowGet)); } }
public JsonResult SiparisTasarimSonucu(string dt) { using (UnitofWork uow = new UnitofWork()) { var urun = uow.GetRepository <Product>().Listele().Select(x => new Product { ID = x.ID, ImagePath = x.ImagePath, ProductName = x.ProductName }).First(x => x.ProductName == dt); return(Json(urun, JsonRequestBehavior.AllowGet)); } }
public ActionResult Order(int id) { Order_Details od = new Order_Details(); using (UnitofWork uow = new UnitofWork()) { var urun = uow.GetRepository <Product>().GetElementById(id); od.ProductName = urun.ProductName; od.ProductID = urun.ID; od.Quantity++; od.UnitPrice = urun.Price; Session.Add("od", od); } return(View()); }
public CategoryService(UnitofWork uow) { _uow = uow; _categoryRepository = uow.GetRepository <Category>(); //_postRepository = uow.GetRepository<Post>(); }
public ActionResult Add() { var list = uow.GetRepository <Category>().Listele(); return(View(list)); }
public ActionResult List() { var list = uow.GetRepository<Order>().Listele(); return View(list); }
public ActionResult Index(int page = 1) { var list = uow.GetRepository <Product>().Listele(); return(View(list.OrderBy(x => x.ProductName).ToPagedList(page, 16))); }