public HttpResponseMessage Delete(int id) { SquadMemberService.Delete(id); SuccessResponse response = new SuccessResponse(); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public HttpResponseMessage SelectAll() { ItemsResponse <SquadMember> response = new ItemsResponse <SquadMember>(); response.Items = SquadMemberService.SelectAll(); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public HttpResponseMessage Update(SquadMemberUpdateRequest model) { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState)); } SquadMemberService.Update(model); SuccessResponse response = new SuccessResponse(); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public HttpResponseMessage Add(SquadMemberAddRequest model) { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState)); } ItemResponse <int> response = new ItemResponse <int>(); response.Item = SquadMemberService.Add(model); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public void OneTimeSetup() { var options = new DbContextOptionsBuilder <TeamFinder3TAppContext>() .UseInMemoryDatabase(databaseName: "FakeTeamFinderDb") .Options; _context = new TeamFinder3TAppContext(options); SquadService squadService = new SquadService(_context); _crudSquad = new CRUDoperationsForSquad(squadService); MemberService memService = new MemberService(_context); _crudMember = new CRUDoperationsForMembers(memService); SquadMemberService squaMemService = new SquadMemberService(_context); _crudSquadMembers = new CRUDoperationsForSquadMembers(squaMemService); _crudSquad.CreateSquad("0102133", "Anthony Barry", 5, "Football"); _crudSquad.CreateSquad("3900011", "Frank Lampard", 5, "Football"); _crudMember.CreateMember("03930", "Andy", "Robertson"); _crudMember.CreateMember("01002", "Diogo", "Jota"); _crudMember.CreateMember("29390", "Sadio", "Mane"); _crudMember.CreateMember("29312", "Mohammed", "Salah"); _crudMember.CreateMember("29390", "Joel", "Matip"); _crudMember.CreateMember("28199", "Timo", "Werner"); _crudMember.CreateMember("77282", "Hakim", "Ziyech"); _crudMember.CreateMember("00012", "Mason", "Mount"); _crudMember.CreateMember("00478", "John", "Terry"); _crudMember.CreateMember("02730", "Kurt", "Zouma"); _crudSquadMembers.CreateSquadMember("03930", "0102133"); _crudSquadMembers.CreateSquadMember("01002", "0102133"); _crudSquadMembers.CreateSquadMember("29390", "0102133"); _crudSquadMembers.CreateSquadMember("29312", "0102133"); _crudSquadMembers.CreateSquadMember("29390", "0102133"); _crudSquadMembers.CreateSquadMember("28199", "3900011"); _crudSquadMembers.CreateSquadMember("77282", "3900011"); _crudSquadMembers.CreateSquadMember("00012", "3900011"); _crudSquadMembers.CreateSquadMember("00478", "3900011"); }
public CRUDoperationsForSquadMembers(SquadMemberService squaMemService) { _squadMemberService = squaMemService; }