/// <summary> /// ViewModel 转 DataModel /// </summary> /// <param name="area"></param> /// <returns></returns> public static AreaInfo AreaVModelToInfo(AreaVModel area) { if (area == null) { return(new AreaInfo()); } return(new AreaInfo { Id = area.Id, Name = area.Name, Code = area.Code, PinYin = area.PinYin, SortPinYin = area.SortPinYin, Sort = area.Sort, ParentCode = area.ParentCode }); }
public JsonResult Add(AreaVModel model) { var result = new JsonResultModel(); if (ModelState.IsValid) { //add result.ResultState = Areas.AddArea(Areas.AreaVModelToInfo(model)) > 0; } else { result.ResultState = false; result.Message = ModelStateHelper.GetAllErrorMessage(ModelState); } return(Json(result)); }
/// <summary> /// 设置区域信息 /// </summary> /// <param name="area"></param> /// <returns></returns> public APIResult SetArea(AreaVModel area) { APIResult rst = new APIResult(); try { rst.Code = 0; rst.Msg = ""; bll.SetArea(area); rst.Data = area.AreaId; } catch (Exception ex) { rst.Code = -1; rst.Msg = ex.Message; FileLog.WriteLog("设置区域信息错误(SetArea):" + ex.Message + ex.StackTrace); } return(rst); }
public APIResult SetArea(AreaVModel area) { return(baseInfoHelper.SetArea(area)); }
public APIResult AddArea(AreaVModel area) { area.AreaId = 0; return(baseInfoHelper.SetArea(area)); }
public ActionResult Add() { var vm = new AreaVModel(); return(View(vm)); }
/// <summary> /// 设置区域信息 /// </summary> /// <param name="area">区域信息</param> /// <returns></returns> public int SetArea(AreaVModel area) { return(dal.SetArea(area)); }