public IActionResult Post([FromBody] TeamCategoryViewModel model) { try { if (ModelState.IsValid) { var newCategory = new TeamCategory() { Name = model.Name }; repository.AddTeamCategory(newCategory); if (repository.SaveAll()) { return(Ok("New team category has been saved")); } } else { return(BadRequest(ModelState)); } } catch (Exception exception) { Console.WriteLine(exception); } return(BadRequest("Failed to save new team category")); }
public Group(TeamCategory c) { hidden = !c.IsPublic; color = c.Color; icpc_id = "cat" + c.CategoryId; id = $"{c.CategoryId}"; name = c.Name; sortorder = c.SortOrder; }
public void AddTeamCategory(TeamCategory teamCategory) { AddEntity(teamCategory); }