public AppCustomerModel GetCustomerModel(int custNo) { //ask for a entity with the id from the Infrastructure repository CustomerEntity customerEntity = customerRepository.GetCustomer(custNo); //check against business rules using ruleService in the domain layer ruleService.Execute(customerEntity); AppCustomerModel customerModel = mapper.Map <AppCustomerModel>(customerEntity); return(customerModel); }
public void getCustomerInfo(int storeId) { VerifySignCheck(); try { if (storeId <= 0) { result.setResult(ApiStatusCode.参数错误, "客户Id丢失"); goto Finish; } CustomerModel model = UserCarLogic.Instance.GetCustomerModel(storeId); if (model == null) { result.setResult(ApiStatusCode.失败, ""); goto Finish; } AppCustomerModel data = new AppCustomerModel() { name = model.UserName, mobile = model.UserMobile, storeId = model.UserId }; if (!string.IsNullOrEmpty(model.UserImg)) { string[] arr = model.UserImg.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); string[] imgData = new string[arr.Length]; for (int i = 0; i < arr.Length; i++) { string imgUrl = "http://" + Context.Request.Url.Authority + arr[i]; imgData[i] = imgUrl; } data.imgData = imgData; } result.setResult(ApiStatusCode.OK, data); } catch (Exception ex) { LogHelper.Debug(string.Format("StackTrace:{0},Message:{1}", ex.StackTrace, ex.Message), this.DebugMode); result.setResult(ApiStatusCode.务器错误, ex.Message); } goto Finish; Finish: JsonResult(result); }
public void Post([FromBody] AppCustomerModel customerModel) { }