public IActionResult Create([Bind("ClubName, ResponsibleName, ResponsibleCellullar, ResponsibleEmail, ClubNumber")] Club club) { if (ModelState.IsValid) { ClubServices services = new ClubServices(_context); services.SaveClub(club); return(RedirectToAction("WhatToDoNow", "Verify", new { clubID = club.ClubID })); } return(View(club)); }
public IActionResult CheckRegistration() { ClubServices service = new ClubServices(_context); Club club = service.CheckRegistration(User.Identity.Name); //Console.WriteLine(User.Identity.Name); if (club == null) { return(RedirectToAction("Create", "Club")); } else { return(RedirectToAction("WhatToDoNow", new { clubID = club.ClubID })); } }
public IActionResult Edit([Bind("ClubID, ClubName, ResponsibleName, ResponsibleCellullar, ResponsibleEmail, ClubNumber")] Club club) { if (ModelState.IsValid) { SecurityServices services = new SecurityServices(_context); bool isValid = services.IsClubIDValidToClubNumber(club.ClubID, User.Identity.Name); if (isValid == true) { ClubServices clubServices = new ClubServices(_context); clubServices.UpdateClub(club); return(RedirectToAction("WhatToDoNow", "Verify", new { clubID = club.ClubID })); } else { return(RedirectToAction("YouCanOnlyLookUpYourOwnData", "Verify")); } } return(View(club)); }
// GET: Club/Edit/5 public IActionResult Edit(int clubID) { SecurityServices services = new SecurityServices(_context); bool isValid = services.IsClubIDValidToClubNumber(clubID, User.Identity.Name); if (isValid == true) { ClubServices clubServices = new ClubServices(_context); Club club = clubServices.GetClub(clubID); if (club == null) { return(NotFound()); } return(View(club)); } else { return(RedirectToAction("YouCanOnlyLookUpYourOwnData", "Verify")); } }