예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,CityId,MunicipalityId,Address1,City,Zip")] Address address)
        {
            if (ModelState.IsValid)
            {
                address.Id = Guid.NewGuid();
                _context.Add(address);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Position,MunicipalityId")] Official official)
        {
            if (ModelState.IsValid)
            {
                official.Id = Guid.NewGuid();
                _context.Add(official);
                await _context.SaveChangesAsync();

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