public async Task <IActionResult> Create([Bind("DinnerId,Title,EventDate,Description,HostedBy,ContactPhone,Address,Country,Latitude,Longitude")] BookDinner dinner) { ViewData["session"] = HttpContext.Session.GetString("userId"); var uid = int.Parse(HttpContext.Session.GetString("Uid")); if (ModelState.IsValid) { dinner.CreatorId = uid; _context.Add(dinner); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Logged))); } return(View(dinner)); }
// GET: Rsvp/Create public IActionResult Create(long id) { Rsvp rsvp = new Rsvp { DinnerId = id, UserName = _userManager.GetUserName(User) }; _context.Add(rsvp); _context.SaveChanges(); return(View(rsvp)); }
public async Task <ActionResult> Registar(RegistrationModel model) { if (ModelState.IsValid) { UserDetails user = new UserDetails { Name = model.Name, Email = model.Email, Password = model.Password }; _context.Add(user); await _context.SaveChangesAsync(); } else { return(View("Registration")); } return(RedirectToAction("Index", "Account")); }