public ActionResult Create(ProjectSubjectDTO entity)
        {
            var errors = "B000";
            string message = string.Empty;

            if (Const.IsNullOrEmpty(entity.Name))
            {
                errors = "B001";
                message = "项目专业名称不能为空。";
            }

            using (DataClassesDataContext data = new DataClassesDataContext())
            {
                if (data.ProjectSubjectDTO.Where(u => u.Name == entity.Name).Count() > 0)
                {
                    errors = "B002";
                    message = "项目专业已经存在。";
                }
                else
                {
                    data.ProjectSubjectDTO.InsertOnSubmit(entity);
                    data.SubmitChanges();
                }
            }

            var retval = new
            {
                success = (errors == "B000"),
                errors = errors,
                message = message
            };

            return Json(retval, "text/html", JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 2
0
 partial void UpdateProjectSubjectDTO(ProjectSubjectDTO instance);
Ejemplo n.º 3
0
 partial void DeleteProjectSubjectDTO(ProjectSubjectDTO instance);
Ejemplo n.º 4
0
 partial void InsertProjectSubjectDTO(ProjectSubjectDTO instance);