public void PostConference(ConferenceDTO conference, string currentUser) { var newAddress = new Address() { Street = conference.Street, City = conference.City, State = conference.State, Zip = conference.Zip }; _addressRepo.add(newAddress); _addressRepo.saveChanges(); var newConference = new Conference { Name = conference.Name, AddressId = newAddress.Id, //Address = _addressRepo.FindByAddress(conference.Street, conference.City, //conference.State, conference.Zip).FirstOrDefault(), ApplicationUserId = (from a in _userRepo.List() where a.UserName == currentUser select a.Id).FirstOrDefault(), ImageUrl = conference.ImageUrl, StartDate = conference.StartDate, EndDate = conference.EndDate }; _confRepo.AddConference(newConference); _confRepo.SaveChanges(); }
public ActionResult Add(Conferences conference) { if (ModelState.IsValid) { _conferenceRepository.AddConference(conference); return(RedirectToAction("Upcoming")); } return(View(conference)); }