Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }