public OurTeam DeleteTeam(int id) { OurTeam dbEntry = context.OurTeams .FirstOrDefault(p => p.Id == id); if (dbEntry != null) { context.OurTeams.Remove(dbEntry); context.SaveChanges(); } return(dbEntry); }
public void SaveTeam(OurTeam team) { if (team.Id == 0) { context.OurTeams.Add(team); } else { OurTeam dbEntry = context.OurTeams .FirstOrDefault(p => p.Id == team.Id); if (dbEntry != null) { dbEntry.Name = team.Name; dbEntry.Position = team.Position; dbEntry.Description = team.Description; dbEntry.Image = team.Image; dbEntry.ImageMimeType = team.ImageMimeType; } } context.SaveChanges(); }