예제 #1
0
        public ActionResult CreateSubmit()
        {
            var project = new D_ProjectCodeServer();

            project.FillWithForm();
            project.ServerID   = Guid.NewGuid().ToString();
            project.CreateUser = "******";
            project.CreateTime = DateTime.Now;

            var rs = ProjectService.AddProjectCodeServer(project);

            Response.Write(rs.ToJson());
            return(View("~/Views/Shared/ResponseHandle.cshtml"));
        }
예제 #2
0
        public static ResponseResult AddProjectCodeServer(D_ProjectCodeServer projectServer)
        {
            var rs = new ResponseResult()
            {
                IsSucess = true
            };


            if (projectServer.ProjectID.IsNullOrEmpty())
            {
                rs.IsSucess = false;
                rs.Message  = "错误参数";
                return(rs);
            }
            if (projectServer.ServerIndex <= 0)
            {
                rs.IsSucess = false;
                rs.Message  = "服务器编号不能为空";
                return(rs);
            }


            //if (DeploymentDAO.QueryService.CTBDeployment.Exist<D_ProjectCodeServer>(t => t.ServerIndex == projectServer.ServerIndex && t.ProjectID==projectServer.ProjectID))
            //{
            //    rs.IsSucess = false;
            //    rs.Message = "服务器编号已存在";
            //    return rs;
            //}



            using (var uow = DeploymentDAO.UnitService.CTBDeployment)
            {
                uow.Create(projectServer);
                uow.Commit();
            }

            rs.IsSucess = true;
            rs.Message  = "保存成功";

            return(rs);
        }