public IActionResult Create(Car car) { if (ModelState.IsValid) { _db.AddCar(car); return(RedirectToAction("Details", new { id = car.Id })); } return(View()); }
public IActionResult GetDataFromViewField(string carModel, string carMark, double carEngine) { var car = new Car() { CarModel = carModel, CarMark = carMark, CarEngine = carEngine }; carData.AddCar(car); return(Redirect("~/")); }
public IActionResult GetDataFromViewField(string carModel, string carMark, double carEngine) { log.LogCritical($" ------- \n >> GetDataFromViewField сработал, carModel = {carModel}\n ------- \n "); var car = new Car() { CarModel = carModel, CarMark = carMark, CarEngine = carEngine }; carData.AddCar(car); return(Redirect("~/")); }
public string AddNewCar(Car car) { return(data.AddCar(car)); }
public IActionResult AddCar(CarModel model) { _carData.AddCar(model); return(Created(HttpContext.Request.Scheme + "://" + HttpContext.Request.Host + HttpContext.Request.Path + "/" + model.Id, model)); }