예제 #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public IActionResult Modify([FromBody] ClientInfo model)
        {
            try
            {
                if (_clientInfoRepository.Count(e => e.ClientName == model.ClientName && e.Id != model.Id && e.UserId == CurrentUser.Id && e.IsDel == 0) > 0)
                {
                    return(JsonError("客户名重复"));
                }

                var oldModel = _clientInfoRepository.GetSingle(model.Id);
                oldModel.UpdateTime      = DateTime.Now;
                oldModel.ProvinceName    = model.ProvinceName;
                oldModel.ProvinceCode    = model.ProvinceCode;
                oldModel.DetailedAddress = model.DetailedAddress;
                oldModel.CountyName      = model.CountyName;
                oldModel.CountyCode      = model.CountyCode;
                oldModel.ClientPhone     = model.ClientPhone;
                oldModel.ClientName      = model.ClientName;
                oldModel.CityName        = model.CityName;
                oldModel.CityCode        = model.CityCode;
                _clientInfoRepository.Update(oldModel);
                return(JsonOk(""));
            }
            catch (Exception ex)
            {
                return(JsonError(ex.Message));
            }
        }
예제 #2
0
 public void UpdateClientInfo(ClientInfo clientInfo)
 {
     _iClientInfoRepository.Update(clientInfo);
     Save();
 }