public async Task <IActionResult> Edit(int id, [Bind("DinnerId,Title,EventDate,Description,HostedBy,ContactPhone,Address,Country,Latitude,Longitude")] BookDinner dinner) { ViewData["session"] = HttpContext.Session.GetString("userId"); if (id != dinner.DinnerId) { return(View("NotFound")); } if (ModelState.IsValid) { try { _context.Update(dinner); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DinnerExists(dinner.DinnerId)) { return(View("NotFound")); } else { throw; } } return(RedirectToAction(nameof(Logged))); } return(View(dinner)); }
public async Task <IActionResult> Edit(long id, [Bind("RsvpId,DinnerId,UserName")] Rsvp rsvp) { if (id != rsvp.RsvpId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rsvp); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RsvpExists(rsvp.RsvpId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DinnerId"] = new SelectList(_context.Dinners, "DinnerId", "Address", rsvp.DinnerId); 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")); }