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

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(advertiser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdvertiserExists(advertiser.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(advertiser));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AdvertiserId,Description,PricePerDay")] Location location)
        {
            if (id != location.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(location);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationExists(location.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Email,Phone,PaymentMethod")] Sponsor sponsor)
        {
            if (id != sponsor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sponsor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SponsorExists(sponsor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sponsor));
        }
        public async Task <IActionResult> Edit(int id,
                                               [Bind("Id,LocationId,SponsorId,Message,Color,Speed,DateStart,DateStop,TotalCost")]
                                               Advertisement advertisement)
        {
            if (id != advertisement.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try {
                    _context.Update(advertisement);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException) {
                    if (!AdvertisementExists(advertisement.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["LocationId"] = new SelectList(_context.Locations, "Id", "Id", advertisement.LocationId);
            ViewData["SponsorId"]  = new SelectList(_context.Sponsors, "Id", "Id", advertisement.SponsorId);
            return(View(advertisement));
        }