public IActionResult Index(EventViewModel model) { if (model.Id == 0) { new EventService(context).Add(model.ToEntity()); } else { new EventService(context).Update(model.Id, model.ToEntity()); } var res = GetList(); return(res); }