public IActionResult Create(BeaconViewModel vm) { if (ModelState.IsValid) { var newBeacon = Mapper.Map<Beacon>(vm); // save to database _repository.AddBeacon(newBeacon); } return RedirectToAction("Index"); }
public IActionResult Edit(BeaconViewModel vm) { if (ModelState.IsValid) { var beaconToUpdate = Mapper.Map<Beacon>(vm); // save to database _repository.Edit(beaconToUpdate); } return RedirectToAction("Index"); }