Exemple #1
0
        public ActionResult AddVehicle(VMVehicle vMVehicle)
        {
            try
            {
                VehicleDetail vehicleDetail = new VehicleDetail();
                vehicleDetail.VehicleName      = vMVehicle.VehicleName;
                vehicleDetail.VehicleNo        = vMVehicle.VehicleNo;
                vehicleDetail.BrandId          = vMVehicle.BrandId;
                vehicleDetail.CategoryId       = vMVehicle.CategoryId;
                vehicleDetail.ColorId          = vMVehicle.ColorId;
                vehicleDetail.Euronum          = vMVehicle.Euronum;
                vehicleDetail.Kilometers       = vMVehicle.Kilometers;
                vehicleDetail.RegistrationYear = vMVehicle.RegistrationYear;
                vehicleDetail.Price            = vMVehicle.Price;
                vehicleDetail.Weight           = vMVehicle.Weight;
                vehicleDetail.NoOfSeats        = vMVehicle.NoOfSeats;
                vehicleDetail.IsSold           = vMVehicle.IsSold;
                vehicleDetail.SoldDate         = vMVehicle.SoldDate;
                vehicleDetail.IsActive         = vMVehicle.IsActive;
                vehicleDetail.IsDelete         = vMVehicle.IsDelete;
                vehicleDetail.CreatedDate      = vMVehicle.CreatedDate;
                vehicleDetail.ModifiedDate     = vMVehicle.ModifiedDate;
                vehicleDetail.CreatedBy        = vMVehicle.CreatedBy;
                vehicleDetail.ModifiedBy       = vMVehicle.ModifiedBy;
                db.VehicleDetails.Add(vehicleDetail);

                foreach (HttpPostedFileBase file in vMVehicle.VehicleImage1)
                {
                    VehicleImage vehicleImage = new VehicleImage();
                    vehicleImage.VehicleImage1 = vMVehicle.VehicleImage1;

                    string VFileName       = Path.GetFileNameWithoutExtension(file.FileName);
                    string VImageExtension = Path.GetExtension(file.FileName);
                    VFileName = VFileName + DateTime.Now.ToString("yymmssff") + VImageExtension;
                    vehicleImage.VehicleImgName = "~/VehicleImages/" + VFileName;
                    VFileName = Path.Combine(Server.MapPath("~/VehicleImages/"), VFileName);
                    file.SaveAs(VFileName);

                    vehicleDetail.VehicleId = vehicleImage.VehicleId;
                    db.VehicleImages.Add(vehicleImage);
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName");
                ViewBag.BrandId    = new SelectList(db.Brands, "BrandId", "BrandName");
                ViewBag.ColorId    = new SelectList(db.Colors, "ColorId", "ColorName");
                return(View());
            }
        }
 public ActionResult Create(Color colors)
 {
     try
     {
         db.Colors.Add(colors);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Create(UserDetail userDetail)
 {
     try
     {
         db.UserDetails.Add(userDetail);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(userDetail));
     }
 }
 public ActionResult AddBrand(Brand brands)
 {
     try
     {
         db.Brands.Add(brands);
         db.SaveChanges();
         return(RedirectToAction("ViewBrand"));
     }
     catch
     {
         ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName");
         return(View());
     }
 }
 public ActionResult AddFeedback(Feedback feedback)
 {
     db.Feedbacks.Add(feedback);
     db.SaveChanges();
     TempData["msg"] = "<script>alert('Thank You!!');</script>";
     return(RedirectToAction("Index"));
 }
        public ActionResult EditpaymentStatus(int id)
        {
            PaymentDetail paymentDetail = db.PaymentDetails.FirstOrDefault(p => p.Id == id);

            paymentDetail.StatusId        = 10;
            db.Entry(paymentDetail).State = EntityState.Modified;
            db.SaveChanges();
            var qid = paymentDetail.QuoteId;

            //return View("ViewInvoice");
            return(Redirect("../ViewInvoice/" + qid));
        }
Exemple #7
0
        public ActionResult Quote(VMVehicle vMVehicle, FormCollection fc)
        {
            if (vMVehicle is null)
            {
                throw new ArgumentNullException(nameof(vMVehicle));
            }

            if (Session["userid"] != null)
            {
                int VehicleId    = Convert.ToInt32(fc["VehicleId"]);
                int uid          = Convert.ToInt32(Session["userid"]);
                int downpayment  = Convert.ToInt32(fc["DownPayment"]);
                int duration     = Convert.ToInt32(fc["Duration"]);
                int TotalPayment = Convert.ToInt32(fc["totalpayment"]);
                if (downpayment != 0 || duration != 0)
                {
                    int DeductDownpayment, PerMonth;

                    DeductDownpayment = TotalPayment - downpayment;
                    PerMonth          = DeductDownpayment / duration;
                    if (PerMonth == 0)
                    {
                        ViewBag.BookingMessage = "Booking not Success!!!!";
                        return(RedirectToAction("/SingleVehicle/" + VehicleId));
                    }
                    else
                    {
                        Quote quote = new Quote()
                        {
                            UserId      = uid,
                            VehicleId   = VehicleId,
                            DownPayment = downpayment,
                            Duration    = duration,
                            TotalAmount = TotalPayment,
                            StatusId    = 1,
                            IsActive    = true,
                            IsDelete    = false,
                        };

                        db.Quotes.Add(quote);
                        if (db.SaveChanges() > 0)
                        {
                            return(RedirectToAction("QuoteList"));
                        }
                        ViewBag.BookingMessage = "Booking not Success!!!!";
                        return(RedirectToAction("/SingleVehicle/" + VehicleId));
                    }
                }
                else
                {
                    ViewBag.AmountMessage = "Amount must not be zero!!!!";
                    //return Redirect("/User/Vehicle/SingleVehicle/"+VehicleId);
                    return(RedirectToAction("/SingleVehicle/" + VehicleId));
                    // return View("/Vehicle/SingleVehicle/"+VehicleId);
                }
            }
            return(Redirect("/User/UserLogin/Login"));
        }
        public ActionResult Registration(UserDetail userdetails)
        {
            if (ModelState.IsValid)
            {
                string password, EncryptedPassword;
                password             = userdetails.Password;
                EncryptedPassword    = PasswordSecurity.EncryptPassword(password);
                userdetails.Password = EncryptedPassword;
                db.UserDetails.Add(userdetails);

                if (db.SaveChanges() > 0)
                {
                    string receiver = userdetails.Email;
                    string subject  = "Registrating";
                    string message  = "You are registered in Vehicle Leasing now you can login";
                    if (MailSending.SendMail(receiver, subject, message))
                    {
                        return(RedirectToAction("Login"));
                    }
                    return(View(userdetails));
                }
            }
            return(View(userdetails));
        }
 public ActionResult AddFeedback(Feedback feedback)
 {
     db.Feedbacks.Add(feedback);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult AddCategory(Category category)
 {
     db.Categories.Add(category);
     db.SaveChanges();
     return(RedirectToAction("ViewCategory"));
 }