Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,女性id,場所,費用,時間帯,備考")] Dating dating)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dating);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["女性id"] = new SelectList(_context.Woman, "Id", "仮名", dating.女性id);
            return(View(dating));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,仮名,本名,年齢,居住地,出身地,職業,年収,顔,胸,体型,出会った日,知り合った方法,備考")] Woman woman)
        {
            if (ModelState.IsValid)
            {
                _context.Add(woman);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["出身地"]     = new SelectList(_context.Prefecture, "Id", "名称", woman.出身地);
            ViewData["居住地"]     = new SelectList(_context.Prefecture, "Id", "名称", woman.居住地);
            ViewData["知り合った方法"] = new SelectList(_context.Method, "Id", "名称", woman.知り合った方法);
            return(View(woman));
        }