Example #1
0
 public void Insert(TelbookModel model)
 {
     using (MySqlConnection conn = new MySqlConnection(_connStr))
     {
         conn.Execute(InsertStr, model);
     }
 }
Example #2
0
        public void Update(string condition, TelbookModel model)
        {
            string sql = GetUpdateSql("Name=@Name,Telephone=@Telephone", condition);

            using (MySqlConnection conn = new MySqlConnection(_connStr))
            {
                conn.Execute(sql, model);
            }
        }
Example #3
0
        public void Insert(TelbookModel model)
        {
            var item = _provider.GetItem(" AND Name=@Name", new { Name = model.Name });

            if (item != null)
            {
                throw new Exception("已存在相同姓名的人员");
            }

            _provider.Insert(model);
        }
Example #4
0
        public void Update(TelbookModel model)
        {
            string condition = "AND Id = @Id";
            var    item      = _provider.GetItem(condition, new { Id = model.Id });

            if (item == null)
            {
                throw new Exception("所要修改的信息不存在,请重试");
            }
            //model.Password = item.Password;
            _provider.Update(condition, model);
        }
Example #5
0
 public IActionResult Add(TelbookModel model)
 {
     try
     {
         _business.Insert(model);
         return(Json(new JsonResultLogModel
         {
             State = true,
             Message = "用户添加成功!",
             Log = $" 用户 {SiteUser.Username} 添加人员 {model.Name} 成功  ",
             LogType = LogType.TelbookManage,
             Username = SiteUser.Username
         }));
     }
     catch (Exception ex)
     {
         return(Json(new { State = false, Message = ex.Message }));
     }
 }
Example #6
0
 //[AuthorizationFilter(Role = UserType.SysAdmin)]
 public JsonResult Edit(TelbookModel model)
 {
     try
     {
         //model.Content.Replace("\r\n", "");
         _business.Update(model);
         return(Json(new JsonResultLogModel
         {
             State = true,
             Message = "用户信息修改成功!",
             Log = $" 用户 {SiteUser.Username} 编辑人员 {model.Name} 成功  ",
             LogType = LogType.TelbookManage,
             Username = SiteUser.Username
         }));
     }
     catch (Exception ex)
     {
         return(Json(new { State = false, Message = ex.Message }));
     }
 }