public ActionResult Edit(int id) { ViewBag.DisplayMenu = "No"; if (IsAdminUser()) { ViewBag.DisplayMenu = "Yes"; } var service = new GymService(); var detail = service.GetGymById(id); var model = new GymEdit { GymId = detail.GymId, Name = detail.Name, MonthlyCost = detail.MonthlyCost, Hours = detail.Hours, Description = detail.Description, Address = detail.Address, Phone = detail.Phone, Website = detail.Website, Size = detail.Size, Equipment = detail.Equipment, LockerRoom = detail.LockerRoom, Classes = detail.Classes, PersonalTraining = detail.PersonalTraining, AdditionalInfo = detail.AdditionalInfo }; return(View(model)); }
public ActionResult DeleteGym(int id) { var service = new GymService(); service.DeleteGym(id); TempData["SaveResult"] = "The gym was deleted."; return(RedirectToAction("Index")); }
public static OcrService GetOcrService(IConfigurationService configurationService, Hydro74000Context context) { IGymRepository gymRepository = new GymRepository(context); IRaidRepository raidRepository = new RaidRepository(context); var localizationService = new LocalizationService(); var gymService = new GymService(gymRepository, localizationService, configurationService); var raidbossService = new RaidbossService(); var fileWatcherService = new FileWatcherService(); var pokemonService = new PokemonService(raidbossService, localizationService, fileWatcherService); var raidService = new RaidService(raidRepository, gymService, pokemonService, raidbossService, localizationService); return(new OcrService(configurationService, gymService, pokemonService, raidService, localizationService)); }
public ActionResult Details(int id) { ViewBag.DisplayMenu = "No"; if (IsAdminUser()) { ViewBag.DisplayMenu = "Yes"; } var service = new GymService(); var model = service.GetGymById(id); return(View(model)); }
// GET: Gym public ActionResult Index() { ViewBag.DisplayMenu = "No"; if (IsAdminUser()) { ViewBag.DisplayMenu = "Yes"; } var service = new GymService(); var model = service.GetGyms(); return(View(model)); }
public void Service_Should_Return_All_Gyms() { // Arrange var gymSrv = new GymService(_gymRepo, _unitOfWork); // Act var result = gymSrv.GetAllGyms(); // Assert for (int i = 0; i < _rndGyms.ToList().Count; i++) { Assert.AreEqual(result.ToList()[i].Id, _rndGyms.ToList()[i].Id); } }
public ActionResult Create(GymCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new GymService(); if (service.CreateGym(model)) { TempData["SaveResult"] = "Gym has been successfully added!"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Gym could not be added."); return(View(model)); }
public void TestPurchasePass() { // precondition /// the user passed in is the friend of someone else. // need to make sure that there is a GiveCredit with this use as the friend //token of this user var token = new Guid("a9b854bc-2e12-4c46-be5a-f052a59733ad"); var request = new PurchaseDayPassRequest { authToken = token.ToString(), gymId = 2258 }; var service = new GymService(); var item = service.PurchaseGym(request); Assert.AreEqual(200, item.status); //to check // both users has +5 credit //Give Credit was changed. }
public ActionResult Edit(int id, GymEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.GymId != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var service = new GymService(); if (service.UpdateGym(model)) { TempData["SaveResult"] = "Gym was successfully updated!"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Gym could not be updated."); return(View(model)); }