示例#1
0
 public BankEntity Update(BankEntity entity)
 {
     try
     {
         _bankRepository.Update(entity);
         return entity;
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return null;
     }
 }
示例#2
0
 public bool Delete(BankEntity entity)
 {
     try
     {
         _bankRepository.Delete(entity);
         return true;
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return false;
     }
 }
示例#3
0
        public HttpResponseMessage Update(BankEntity bank)
        {
            if (PageHelper.ValidateNumber(bank.Id.ToString()) && !string.IsNullOrEmpty(bank.Codeid))
            {
                var bankEntity = _bankService.GetBankById(Convert.ToInt32(bank.Id));

                bankEntity.Codeid = bank.Codeid;

                try
                {
                    if (_bankService.Update(bankEntity) != null)
                    {
                        return PageHelper.toJson(PageHelper.ReturnValue(true, "数据更新成功!"));
                    }
                }
                catch
                {
                    return PageHelper.toJson(PageHelper.ReturnValue(false, "数据更新失败!"));
                }
            }
            return PageHelper.toJson(PageHelper.ReturnValue(false, "数据验证错误!"));
        }
示例#4
0
        public HttpResponseMessage AddBank([FromBody] BankEntity bank)
        {
            var entity = new BankEntity
            {
                Addtime = DateTime.Now,
                Codeid = bank.Codeid
            };

            try
            {
                if (_bankService.Create(entity) != null)
                {
                    return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功!"));
                }
            }
            catch
            {
                return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败!"));
            }
            return PageHelper.toJson(PageHelper.ReturnValue(false, "数据验证错误!"));
        }