Esempio n. 1
0
 public IActionResult Delete(int id)
 {
     using (var context = new SportsClubDBContext())
     {
         Member member = context.Members.First(m => m.MemberId == id);
         if (member != null)
         {
             context.Members.Add(member);
             context.SaveChanges();
             return(Ok());
         }
         else
         {
             return(BadRequest());
         }
     }
 }
Esempio n. 2
0
 public IActionResult Put(Member member)
 {
     using (var context = new SportsClubDBContext())
     {
         Sport sport = context.Sports.First(s => s.SportId == member.Sport.SportId);
         if (sport != null)
         {
             member.Sport = sport;
             context.Members.Add(member);
             context.SaveChanges();
             return(Ok());
         }
         else
         {
             return(BadRequest());
         }
     }
 }