//Refactor private WrestlerService CreateWrestlerService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new WrestlerService(userId); return(service); }
private bool SetStarState(int wrestlerId, bool newState) { //Create the Service var userId = Guid.Parse(User.Identity.GetUserId()); var service = new WrestlerService(userId); //Get the Wrestler var detail = service.GetWrestlerById(wrestlerId); //Create the WrestlerEdit model instance with the new star state var updatedWrestler = new WrestlerEdit { WrestlerId = detail.WrestlerId, RingName = detail.RingName, IsStarred = newState, Gender = detail.Gender, PromotionId = detail.PromotionId, PromotionName = detail.PromotionName, Promotions = detail.Promotions, Wins = detail.Wins, Losses = detail.Losses }; //Return a value indicating whether the update succeeded or not return(service.UpdateWrestler(updatedWrestler)); }
// GET: Wrestler public ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new WrestlerService(userId); var model = service.GetWrestlers(); return(View(model)); }