public JsonResult AddNewProject(TeamProjectPostJsonModel projectJson) { var project = _projectMapper.TeamProjectPostJsonModelToProject(projectJson); var group = _groupMapper.ManagerPostTeamJsonModelToGroup(projectJson.Team); var trainees = projectJson.Team.Trainees.Select(_traineeMapper.TraineeJsonToTraineeMentorId).ToList(); var newProject = _projectProvider.AddProject(project); var newGroup = _groupProvider.AddGroup(trainees, group, newProject); return(Json(newGroup.Id)); }
public JsonResult AddGroup(string groupname) { if (string.IsNullOrEmpty(groupname)) { return(Json(new ResultModel(false, "集团名称不能为空"))); } var mode = new GroupModel { GroupName = groupname.Trim(), CreateName = UserContext.Current.Name, CreateTime = DateTime.Now }; var result = iGroupServices.HasExistsGroup(mode); if (result.Result) { if (result.Data) { return(Json(new ResultModel(false, "集团名称已经存在"))); } } else { return(Json(new ResultModel(false, "服务器异常"))); } mode.IsValid = 1; var res = iGroupServices.AddGroup(mode); return(Json(res.Result ? new ResultModel(true, "成功") : new ResultModel(false, "服务器异常"))); }