public ActionResult CreateProvince(ProvinceViewModel province) { var nprov = new ProvinceRequest() { Description = province.Description, CountryId = province.CountryId }; try { var result = false; if (province.Id == 0) { result = this.ProvinceService.CreateProvince(nprov); } if (result) { return(Redirect("/System/Index")); } else { return(View("../Shared/Error")); } } catch (Exception ex) { return(View("../Shared/Error")); } }
public string GetProvinceInfo(ProvinceRequest request) { if (request.Level.ToLower() == "province") { var result = ProvinceHelper.Instance.GetProvince(); return(result); } else if (request.Level.ToLower() == "city") { if (!request.AreaName.IsNullOrEmpty()) { var result = ProvinceHelper.Instance.GetCity(request.AreaName); return(result); } } else if (request.Level.ToLower() == "area") { if (!request.AreaName.IsNullOrEmpty()) { var result = ProvinceHelper.Instance.GetArea(request.AreaName); return(result); } } return("[]"); }
public bool Insert(ProvinceRequest request, int sysUserId, out string msg) { bool flag = false; msg = string.Empty; try { if (request.Name.IsEmpty()) { msg = "名称不能为空"; return(flag); } _dbContext.Insert(new t_sys_province { name = request.Name, isInter = request.IsInter }); flag = true; } catch (Exception ex) { flag = false; msg = "服务异常"; LogUtils.LogError("ProvinceService.Insert", ex); } return(flag); }
public bool Edit(ProvinceRequest request, int sysUserId, out string msg) { bool flag = false; msg = string.Empty; try { if (request.Name.IsEmpty()) { msg = "名称不能为空"; return(flag); } t_sys_province province = _dbContext.Get <t_sys_province>(request.Id); if (province != null) { province.name = request.Name; province.isInter = request.IsInter; province.updatetime = DateTime.Now; _dbContext.Update(province); flag = true; } else { msg = "数据信息不存在"; } } catch (Exception ex) { flag = false; msg = "服务异常"; LogUtils.LogError("ProvinceService.Edit", ex); } return(flag); }
public ContentResult editprovince(ProvinceRequest request) { var msg = string.Empty; var flag = _provinceService.Edit(request, UserContext.SysUserContext.Id, out msg); return(Result <string>(flag, msg)); }
public ProvinceResponse GetProvinceInfos(ProvinceRequest provinceRequest) { ProvinceResponse response = new ProvinceResponse(); response.ProvinceInfos = BaseBLL <ProvinceBLL> .Instance.GetProvinceInfos(); return(response); }
public IHttpActionResult Post(ProvinceRequest province) { var result = ProvinceService .CreateProvince(province); return(Created <Entidad>("", new Entidad { Id = result.Id })); }
public Province CreateProvince(ProvinceRequest province) { var entity = new DomainModel.Province() { Description = province.Description, Country = this.CountryRepository.GetById(province.CountryId) }; this.ProvinceRepository.Insert(entity); return(entity); }
/// <summary> /// 获取省份信息,用作绑定下拉框 /// </summary> /// <param name="province"></param> /// <returns></returns> public JsonResult GetProvince(ProvinceRequest province) { return(Json(userBll.GetProvince(province))); }
/// <summary> /// 获取地区集合 /// </summary> public JsonResult GetProvinceInfos(ProvinceRequest provinceRequest) { return(Json(bll.GetProvinceInfos(provinceRequest))); }
public bool CreateProvince(ProvinceRequest Province) { return(IntegrationService.RestCallNoReturn(ConfigurationManager.AppSettings["ApiCoreUrl"], ApiCore.CreateProvince, RestMethod.Post, null, Province)); }
///// <summary> ///// 获取用户 ///// </summary> ///// <param name="request"></param> //public void GetUserInfo(UserGetRequest request) //{ // UserGetResponse response = new UserGetResponse(); // ApiRequestHelper.Post<UserGetRequest, UserGetResponse>(request); //} /// <summary> /// 获取省份信息,用作绑定下拉框 /// </summary> /// <param name="province"></param> /// <returns></returns> public ProvinceResponse GetProvince(ProvinceRequest province) { return(ApiRequestHelper.Post <ProvinceRequest, ProvinceResponse>(province)); }