Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("AdvertiserID,FirstName,LastName,PhoneNumber,EmailAddress,CompanyID")] Advertiser advertiser)
        {
            if (id != advertiser.AdvertiserID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(advertiser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdvertiserExists(advertiser.AdvertiserID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["CompanyID"] = new SelectList(_context.Companies, "CompanyID", "CompanyID", advertiser.CompanyID);
            PopulateCompanyDropDownList(advertiser.CompanyID);
            return(View(advertiser));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("CompanyID,CompanyName")] Company company)
        {
            if (id != company.CompanyID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(company);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.CompanyID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("EventCategoryID,EventCategoryLogo,CategoryName")] EventCategory eventCategory)
        {
            if (id != eventCategory.EventCategoryID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eventCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventCategoryExists(eventCategory.EventCategoryID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(eventCategory));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("EventID,EventName,EventLocation,Date,Description,EventLogo,Promotional,EventCategoryID,AdvertiserID")] Event @event)
        {
            if (id != @event.EventID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@event);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventExists(@event.EventID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                //if (@event.EventCategoryID.HasValue)
                //{
                //    int CategoryID = @event.EventCategoryID.Value;
                //    return RedirectToAction("IndexCustomized","Events", new { id = CategoryID });
                //}
                //else
                {
                    return(RedirectToAction(nameof(Index)));
                }
            }
            ViewData["AdvertiserID"] = new SelectList(_context.Advertisers, "AdvertiserID", "AdvertiserID", @event.AdvertiserID);
            return(View(@event));
        }