示例#1
0
        public ActionResult Register(AppUser a, HttpPostedFileBase file)
        {
            if (uow.GetRepository <AppUser>().Listele().Any(x => x.UserName == a.UserName || x.Email == a.Email))
            {
                return(RedirectToAction("Index", "Home"));
            }


            else
            {
                if (file != null)
                {
                    WebImage img      = new WebImage(file.InputStream);
                    FileInfo fileInfo = new FileInfo(file.FileName);

                    string newfile = Guid.NewGuid().ToString() + fileInfo.Extension;
                    img.Resize(400, 500);
                    img.Save("~/Content/Images/" + newfile);
                    a.ImagePath = "/Content/Images/" + newfile;
                }


                a.Role = Role.Admin;
                uow.GetRepository <AppUser>().Ekle(a);
                uow.SaveChanges();
                return(Redirect("/User/Login"));
            }
        }
示例#2
0
 public ActionResult Delete(int id)
 {
     using (UnitofWork uow = new UnitofWork())
     {
         uow.GetRepository <Category>().Sil(id);
         uow.SaveChanges();
     }
     return(Redirect("/Admin/Category/List"));
 }
示例#3
0
 public ActionResult Update(Category c)
 {
     using (UnitofWork uow = new UnitofWork())
     {
         uow.GetRepository <Category>().Guncelle(c);
         uow.SaveChanges();
     }
     return(Redirect("/Admin/Category/List"));
 }
示例#4
0
        public ActionResult Comment(int id, Comment c)
        {
            var p = uow.GetRepository <Product>().GetElementById(id);

            c.Product   = p;
            c.ProductID = id;
            uow.GetRepository <Comment>().Ekle(c);
            uow.SaveChanges();
            return(Redirect("/Home/Details/" + id));
        }
        public ActionResult Add(Product p, HttpPostedFileBase File)
        {
            if (ModelState.IsValid)
            {
                if (File != null)
                {
                    WebImage img      = new WebImage(File.InputStream);
                    FileInfo fileinfo = new FileInfo(File.FileName);

                    string newfile = Guid.NewGuid().ToString() + fileinfo.Extension;
                    img.Resize(582, 640);
                    img.Save("~/Content/Images/" + newfile);
                    p.ImagePath = "/Content/Images/" + newfile;
                }

                uow.GetRepository <Product>().Ekle(p);
                uow.SaveChanges();
            }

            return(Redirect("/Admin/Product/List"));
        }
示例#6
0
        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"));
        }
示例#7
0
 public ActionResult Update(Order o)
 {
     uow.GetRepository<Order>().Guncelle(o);
     uow.SaveChanges();
     return Redirect("/Admin/Order/List");
 }