Exemplo n.º 1
0
 public ActionResult Register(Customer reg)
 {
     if (ModelState.IsValid)
     {
         db.Customers.Add(reg);
         db.SaveChanges();
         return(RedirectToAction("Login"));
     }
     return(View());
 }
        public ActionResult Addnewcar(Car d, HttpPostedFileBase imgfile)
        {
            Car    di   = new Car();
            string path = uploadimage(imgfile);

            if (path.Equals("-1"))
            {
            }
            else
            {
                di.CarType   = d.CarType;
                di.CarModel  = d.CarModel;
                di.CarBrand  = d.CarBrand;
                di.prize     = d.prize;
                di.Available = d.Available;
                di.ImagePath = path;
                db.Cars.Add(di);
                db.SaveChanges();
                ViewBag.msg = "data added...";
            }
            ModelState.Clear();
            return(View());
        }