public IActionResult FormModal(string routeValues) { string[] split = routeValues.Split(','); NumberFormatInfo provider = new NumberFormatInfo(); provider.NumberDecimalSeparator = "."; provider.NumberGroupSeparator = ","; provider.NumberGroupSizes = new int[] { 3 }; double offsetx = Convert.ToDouble(split[0], provider); double offsety = Convert.ToDouble(split[1], provider); Guid id = new Guid(split[2]); Guid carId = new Guid(split[3]); bool enddmg = false; CarDamage damage = new CarDamage { OffsetX = offsetx, OffsetY = offsety, Id = id, CarId = carId, RentId = Guid.Empty, IsEndDamage = enddmg, DateMarked = DateTime.Now, }; _carDamagesRepository.Add(damage); RentFormModalViewModel model = new RentFormModalViewModel { Id = id }; return(PartialView(model)); }
public IActionResult PostModal(RentFormModalViewModel model) { if (ModelState.IsValid) { CarDamage damage = _carDamagesRepository.GetCarDamage(model.Id); damage.Description = model.Description; damage.DamageType = model.DamageType; _carDamagesRepository.Update(damage); } return(PartialView("CloseModal")); }