public void UpdateData(ShowroomItem item) { if (item == null) { throw new ArgumentNullException("item"); } _repository.Update(item); }
public async Task <IActionResult> Edit(ShowroomEditViewModel model) { if (ModelState.IsValid) { Showroom showroom = await _showroomModel.GetById(model.Id); showroom = _mapper.Map <Showroom>(model); await _showroomModel.Update(showroom); return(RedirectToAction(nameof(Details), new { id = showroom.Id })); } return(View(model)); }
public async Task <IActionResult> Create(CarEditViewModel uniqueModelName) { if (!ModelState.IsValid) { var showrooms = await _showroomModel.GetAllActive(); uniqueModelName.SetList(showrooms); return(View(uniqueModelName)); } Car car = _mapper.Map <Car>(uniqueModelName); Showroom showroom = await _showroomModel.GetById(uniqueModelName.ShowroomId); await _carModel.Create(car); showroom.Cars.Add(car); await _showroomModel.Update(showroom); return(RedirectToAction(nameof(Details), new { id = car.Id })); }
public void Update(Showroom_API entity) { _repo.Update(entity.ToDAL()); }