public async Task <IActionResult> AddActivity(int?id) { if (id == null) { return(NotFound()); } var referee = await _dataContext.Referees.FindAsync(id); if (referee == null) { return(NotFound()); } var model = new ActivityViewModel { RefereeId = referee.Id, ActivityTypes = _combosHelper.GetComboActivityTypes() }; return(View(model)); }
public ActivityViewModel ToActivityViewModel(Activity activity) { return(new ActivityViewModel { Address = activity.Address, Services = activity.Services, Id = activity.Id, IsAvailable = activity.IsAvailable, Neighborhood = activity.Neighborhood, Referee = activity.Referee, Price = activity.Price, ActivityImages = activity.ActivityImages, ActivityType = activity.ActivityType, Remarks = activity.Remarks, RefereeId = activity.Referee.Id, ActivityTypeId = activity.ActivityType.Id, ActivityTypes = _combosHelper.GetComboActivityTypes(), }); }