示例#1
0
        public static string Validate(FunsCate model)
        {
            string slt = string.Empty;

            if (model == null)
            {
                slt = "实体不能为空";
            }
            else if (string.IsNullOrEmpty(model.Name))
            {
                slt = "名称不能为空";
            }
            return(slt);
        }
示例#2
0
        public static JsonMessage Add(FunsCate model)
        {
            JsonMessage slt = new JsonMessage()
            {
                Flag = false
            };

            slt.Message = Validate(model);
            if (string.IsNullOrEmpty(slt.Message))
            {
                string sql    = "insert into FunsCate(Name,Code,ParentID,Intime,GroupIndex)values(@name,@code,@parentid,@intime,@groupindex);";
                var    result = Conn.Get().Execute(sql, new {
                    name       = model.Name,
                    code       = model.Code,
                    parentid   = model.ParentID,
                    intime     = DateTime.Now,
                    groupindex = model.GroupIndex
                });
                slt.Flag = result > 0;
            }
            return(slt);
        }
 public JsonResult Add(FunsCate model)
 {
     return(Json(FunsCateService.Add(model)));
 }