Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Email,Phone,AmountEarned")] Advertiser advertiser)
        {
            if (ModelState.IsValid)
            {
                _context.Add(advertiser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(advertiser));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,AdvertiserId,Description,PricePerDay")] Location location)
        {
            if (ModelState.IsValid)
            {
                _context.Add(location);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Email,Phone,PaymentMethod")] Sponsor sponsor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sponsor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sponsor));
        }
        public async Task <IActionResult> Create(
            [Bind("Id,LocationId,SponsorId,Message,Color,Speed,DateStart,DateStop,TotalCost")]
            Advertisement advertisement)
        {
            if (ModelState.IsValid)
            {
                _context.Add(advertisement);
                await _context.SaveChangesAsync();

                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));
        }