Exemplo n.º 1
0
 public ActionResult EditBrand([Bind(Include = "BrandID,BrandName,Description")] Brand brand)
 {
     if (ModelState.IsValid)
     {
         dbwatch.Entry(brand).State = EntityState.Modified;
         dbwatch.SaveChanges();
         return(RedirectToAction("ViewBrand"));
     }
     return(View(brand));
 }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "CateID,CateName")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
        public ActionResult Create([Bind(Include = "CusName,Password,FullName,BirthDay,Gender,Email,Phone,Address")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customer.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
        public ActionResult Create([Bind(Include = "BrandID,BrandName,Description")] Brand brand)
        {
            if (ModelState.IsValid)
            {
                db.Brand.Add(brand);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(brand));
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "OrderID,CusName,Date,Payment,Status")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Order.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CusName = new SelectList(db.Customer, "CusName", "Password", order.CusName);
            return(View(order));
        }
        public ActionResult Create([Bind(Include = "FBackID,Title,Content,Status,CusName")] FeedBack feedBack)
        {
            if (ModelState.IsValid)
            {
                db.FeedBacks.Add(feedBack);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CusName = new SelectList(db.Customers, "CusName", "Password", feedBack.CusName);
            return(View(feedBack));
        }
        public ActionResult Create([Bind(Include = "ProID,ProName,CateID,Price,Specials,Description,Origin,Image,BrandID")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BrandID = new SelectList(db.Brands, "BrandID", "BrandName", product.BrandID);
            ViewBag.CateID  = new SelectList(db.Categories, "CateID", "CateName", product.CateID);
            return(View(product));
        }
 public ActionResult EditCustomer([Bind(Include = "CusName,Password,FullName,BirthDay,Gender,Email,Phone,Address")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ThanksEdit", "Customers"));
     }
     return(View(customer));
 }
        // GET: FeedBacks/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FeedBack feedBack = db.FeedBacks.Find(id);

            if (feedBack == null)
            {
                return(HttpNotFound());
            }
            else
            {
                feedBack.Status          = false;
                db.Entry(feedBack).State = EntityState.Modified;
                db.SaveChanges();
            }
            ViewBag.tt = feedBack;
            return(View());
        }
Exemplo n.º 10
0
 public ActionResult Register(Customer cus)
 {
     if (ModelState.IsValid)
     {
         using (DBWatchEntities dbwatch = new DBWatchEntities())
         {
             dbwatch.Customers.Add(cus);
             dbwatch.SaveChanges();
         }
         ModelState.Clear();
         ViewBag.Message = cus.CusName + " successfully registered.";
     }
     return(View("Register"));
 }
Exemplo n.º 11
0
        public ActionResult CreateBrand(Brand newBrand)
        {
            try
            {
                dbwatch = new DBWatchEntities();

                Brand brand = new Brand();
                brand.BrandName   = brand.BrandName;
                brand.Description = brand.Description;


                //Add data in sql
                dbwatch.Brands.Add(newBrand);

                //Save changes
                dbwatch.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(RedirectToAction("viewBrand", "Admin"));
        }
Exemplo n.º 12
0
 public void create(Customer customer)
 {
     dbwatch.Customers.Add(customer);
     dbwatch.SaveChanges();
 }