public ActionResult Create(TeamVM model) { try { if (ModelState.IsValid) { model.Name = model.Name.Replace(" ", ""); var teamId = _teamManager.SaveTeam(model); return(Json(new { Status = "Success" })); } return(View(model)); } catch (Exception ex) { } return(Json(new { Status = "Error" })); }
public ActionResult Create(TeamVM model) { try { if (ModelState.IsValid) { model.Name = model.Name.Replace(" ", ""); var teamId = teamManager.SaveTeam(model); return(Json(new { Status = "Success" })); //Team team = new Team { Name = model.Name, ID = model.Id }; //bool isNew = (model.Id == 0); //if (!isNew) //{ // team = repo.GetTeam(model.Id); // team.Name = model.Name; //} //else //{ // team.CreatedByID = UserID; //} //var result = repo.SaveTeam(team); //if (result != null) //{ // if (isNew) // { // var teamMember = new TeamMember { MemberID = UserID, TeamID = team.ID, CreatedByID = UserID }; // repo.SaveTeamMember(teamMember); // } // return Json(new { Status = "Success" }); //} } return(View(model)); } catch (Exception ex) { } return(Json(new { Status = "Error" })); }