public async Task Create_Valid_ReturnLeague() { var admin = DbContextUtility.AddNew <ApplicationUser>(dbContext); var game = DbContextUtility.AddNew <Game>(dbContext); var league = await testObj.Create("", game.ID, admin.Id); Assert.IsNotNull(league); }
public virtual ActionResult Create(LeagueViewModel model) { if (ModelState.IsValid) { var league = new League() { Name = model.Name, Country = model.Country, DescriptionName = model.DescriptionName }; if (model.Image != null) { var imageManager = new ImageManager(model.Image, ImageFolder.Leagues, string.Empty); if (UploadImage(imageManager)) { league.ImagePath = imageManager.FilePath; } } _leagueService.Create(league); return(RedirectToAction(MVC.Admin.Leagues.Index())); } return(View(model)); }
public IHttpActionResult CreateLeague([FromBody] League league) { try { var updatedLeague = _leagueService.Create(league); return(Ok(updatedLeague)); } catch (Exception e) { return(InternalServerError(e)); } }