private void View_OnUpdateCity(object sender, IdEventArgs e) { City city = this.cityService.GetById(e.Id); if (city == null) { this.View.ModelState.AddModelError("", string.Format("City with id {0} does not exist", e.Id)); return; } this.View.TryUpdateModel(city); if (this.View.ModelState.IsValid) { this.cityService.UpdateCity(city); } }
private void View_OnDelete(object sender, IdEventArgs e) { this.cityService.DeleteCity(e.Id); }