public void Initialize() { this.businessLayer = new Mock <ILeagueService>(); this.regionManager = new Mock <IRegionManager>(); this.interactionService = new Mock <IInteractionService>(); this.businessLayer.Setup(x => x.GetTeamsList()).ReturnsAsync(this.TeamsList); this.viewModel = new FootballerFormViewModel(this.regionManager.Object, this.interactionService.Object, this.businessLayer.Object); this.navigationContext = new NavigationContext(new Mock <IRegionNavigationService>().Object, new Uri("http://www.test.com")); this.businessLayer.Setup(x => x.GetFootballer(It.IsAny <int>())).ReturnsAsync(new Footballer()); }
public ActionResult Create(FootballerFormViewModel model) { if (model != null && model.File != null) { var footballer = Mapper.Map <FootballerFormViewModel, Footballer>(model); footballerService.CreateFootballer(footballer); string footballerPicture = System.IO.Path.Combine(model.File.FileName); string path = System.IO.Path.Combine(Server.MapPath("~/Images/"), footballerPicture); model.File.SaveAs(path); footballerService.Save(); } var position = positionService.GetPosition(model.FormPositionID); return(RedirectToAction("Index", new { position = position.Name })); }