예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,StreetAddress,ZipCode,County,Country,Ssn,PhoneNumber,Email")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
        public async Task <IActionResult> Create([Bind("Id,LocationName,LocationStreetAddress,LocationZipCode,LocationCounty,LocationCountry")] 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,ShowCaseInfo")] ShowCaseDescription showCaseDescription)
        {
            if (ModelState.IsValid)
            {
                _context.Add(showCaseDescription);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(showCaseDescription));
        }
        public async Task <IActionResult> Create([Bind("Id,SwocaseName,LocationId,ShowCaseDescriptionId,PersonId")] ShowCase showCase)
        {
            if (ModelState.IsValid)
            {
                _context.Add(showCase);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LocationId"]            = new SelectList(_context.Location, "Id", "LocationString", showCase.LocationId);
            ViewData["PersonId"]              = new SelectList(_context.Person, "Id", "FullName", showCase.PersonId);
            ViewData["ShowCaseDescriptionId"] = new SelectList(_context.ShowCaseDescription, "Id", "ShowCaseInfo", showCase.ShowCaseDescriptionId);
            return(View(showCase));
        }