public ClubResponse DeleteClub(ClubResponse club)
        {
            ClubResponse dbEntry = context.Clubs.FirstOrDefault(p => p.ClubID == club.ClubID);

            if (dbEntry != null)
            {
                context.Clubs.Remove(dbEntry);
                context.SaveChanges();
            }
            return(dbEntry);
        }
 public void SaveClub(ClubResponse club)
 {
     if (club.ClubID == 0)
     {
         context.Clubs.Add(club);
     }
     else
     {
         ClubResponse dbEntry = context.Clubs.FirstOrDefault(p => p.ClubID == club.ClubID);
         if (dbEntry != null)
         {
             dbEntry.ClubName    = club.ClubName;
             dbEntry.ManagerName = club.ManagerName;
             dbEntry.Location    = club.Location;
         }
     }
     context.SaveChanges();
 }
Example #3
0
 public static void AddResponse(ClubResponse clubResponse)
 {
     clubResponses.Add(clubResponse);
 }
 public void AddNewClub(ClubResponse club)
 {
     context.Clubs.Add(club);
     context.SaveChanges();
 }