/// <summary> /// 添加水电费信息 /// </summary> /// <param name="CostInfoJson">前台返回的Json数据</param> /// <returns></returns> public string CostInfoAdd(string CostInfoJson) { //Json转实体类 CostInfoInputDTO complaInfo = JsonConvert.DeserializeObject <CostInfoInputDTO>(CostInfoJson); complaInfo.AdminID = Session["AdminID"].ToString(); if (CostInfoService.DTOAdd(complaInfo)) { return("ok"); } else { return("no"); } }
/// <summary> /// DTO添加水电费信息 /// </summary> /// <param name="inputentity"></param> /// <returns></returns> public bool DTOAdd(CostInfoInputDTO inputentity) { //AutoMapper转换 CostInfo dataModel = Mapper.Map <CostInfoInputDTO, CostInfo>(inputentity); dataModel.CostID = CreateOrderCode(); if (costInfoDAL.AddAndSaveChange(dataModel) > 0) { return(true); } else { return(false); } }