public async Task <IActionResult> Create([Bind("CompanyID,CompanyName")] Company company) { if (ModelState.IsValid) { _context.Add(company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(company)); }
public async Task <IActionResult> Create([Bind("EventCategoryID,EventCategoryLogo,CategoryName")] EventCategory eventCategory) { if (ModelState.IsValid) { _context.Add(eventCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(eventCategory)); }
public async Task <IActionResult> Create([Bind("AdvertiserID,FirstName,LastName,PhoneNumber,EmailAddress,CompanyID")] Advertiser advertiser) { if (ModelState.IsValid) { _context.Add(advertiser); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } // ViewData["CompanyID"] = new SelectList(_context.Companies, "CompanyID", "CompanyID", advertiser.CompanyID); PopulateCompanyDropDownList(advertiser.CompanyID); return(View(advertiser)); }
public async Task <IActionResult> Create([Bind("EventID,EventName,EventLocation,Date,Description,EventLogo,Promotional,EventCategoryID,AdvertiserID")] Event @event) { if (ModelState.IsValid) { _context.Add(@event); await _context.SaveChangesAsync(); return(RedirectToAction("IndexCustomized", "Events", new { id = @event.EventCategoryID })); } //ViewData["AdvertiserID"] = new SelectList(_context.Advertisers, "AdvertiserID", "AdvertiserID", @event.AdvertiserID); PopulateCompanyDropDownList(@event.AdvertiserID); return(View(@event)); }