/// <summary> /// 用户增加 /// </summary> /// <param name="user"></param> /// <returns></returns> public static Result UserAdd(SysUser user) { using (DataEntities ent = new DataEntities()) { Result r = new Result(); if ((from l in ent.SysUser where l.UserName == user.UserName select l).Count() > 0) { r.Success = false; r.Text = "这个账号已经存在,请重新选择一个账号!"; return r; } else { ent.AddToSysUser(user); ent.SaveChanges(); r.Success = true; r.Text = "添加用户成功!"; return r; } } }