public async Task <IActionResult> Create([Bind("UserId,Name,Tell,ParentTell,Country,Birthday,HefzValue,Address")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("ClassRoomId,Name,ClassTime,OstadId,UserId,Image")] ClassRoom classRoom)
        {
            if (ModelState.IsValid)
            {
                _context.Add(classRoom);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OstadId"] = new SelectList(_context.Ostads, "OstadId", "Name", classRoom.OstadId);
            return(View(classRoom));
        }