public Car(CarsModels model, int maxSpeed = 0) { CarModel = model; CarYearManuf = DateTime.Today.Year; CarMaxSpeed = maxSpeed; CarsCreated++; }
public ActionResult DeleteConfirmed(int id) { CarsModels carsModels = db.Car.Find(id); db.Car.Remove(carsModels); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,IdCar,Brand,Model,YearOfProduction,VIN,Series,Phonenumber,PhotoURL,Description,SellingPrice")] CarsModels carsModels) { if (ModelState.IsValid) { db.Entry(carsModels).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(carsModels)); }
public Car(CarsModels model, CarsColors color, int year, int mileage = 0, int maxSpeed = 200, string info = "") { CarModel = model; CarColor = color; CarYearManuf = year; CarMileage = mileage; CarMaxSpeed = maxSpeed; AditionalInform = info; CarsCreated++; }
public Car(CarsModels model, int maxSpeed = 0) { this._carModel = model; this._carColor = 0; this._carYearManuf = DateTime.Today.Year; this._carMileage = 0; this._carMaxSpeed = maxSpeed; this._additionalInform = ""; _сarsCreated++; }
public Car() { this._carModel = 0; this._carColor = 0; this._carYearManuf = DateTime.Today.Year; this._carMileage = 0; this._carMaxSpeed = 200; this._additionalInform = ""; _сarsCreated++; }
// GET: CarsModels/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CarsModels carsModels = db.Car.Find(id); if (carsModels == null) { return(HttpNotFound()); } return(View(carsModels)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CarsModels carsModels = db.Car.Find(id); if (carsModels == null) { return(HttpNotFound()); } ViewBag.Phonenumber = carsModels.Phonenumber; return(View(carsModels)); }
public ActionResult Create([Bind(Include = "ID,IdCar,Brand,Model,YearOfProduction,VIN,Series,Phonenumber,PhotoURL,Description,SellingPrice")] CarsModels carsModels) { //string fname = Path.GetFileNameWithoutExtension(carsModels.ImageFile.FileName); //string extension = Path.GetExtension(carsModels.ImageFile.FileName); //fname = fname + DateTime.Now.ToString("yymmssfff") + extension; //carsModels.PhotoURL = fname; if (ModelState.IsValid) { string usrID = User.Identity.GetUserId(); var o = db.Owner.Where(x => x.UserID == usrID).FirstOrDefault(); carsModels.Phonenumber = o.PhoneNumber; db.Car.Add(carsModels); o.Cars.Add(carsModels); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(carsModels)); }