public async Task Insert(ExpenseCategoryBll element) { expenseCategory expenseCategorys = Mapper.Map <ExpenseCategoryBll, expenseCategory>(element); _unitOfWork.expenseCategoryUnitOfWork.Insert(expenseCategorys); await _unitOfWork.Save(); }
public async Task Update(ExpenseCategoryBll elementToUpdate) { expenseCategory expenseCategorys = Mapper.Map <ExpenseCategoryBll, expenseCategory>(elementToUpdate); _unitOfWork.expenseCategoryUnitOfWork.Update(expenseCategorys); await _unitOfWork.Save(); }
/// <summary> /// 删除费用类别 /// </summary> /// <param name="id"></param> /// <returns></returns> public JsonResult DeleteExpenseCategoryById(string id) { var retModel = new JsonReturnModel(); try { var result = ExpenseCategoryBll.DeleteExpenseCategoryById(inn, id); if (result.isError()) { retModel.AddError("errorMessage", result.getErrorString()); } } catch (Exception ex) { retModel.AddError("errorMessage", ex.Message); } return(Json(retModel, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 保存数据 /// </summary> /// <returns></returns> public JsonResult SaveExpenseCategory(ExpenseCategoryModel model) { var retModel = new JsonReturnModel(); try { //判断费用类别是否已经存在 if (ExpenseCategoryBll.IsExistExpenseCategory(inn, model.b_CostName, model.Id)) { retModel.AddError("errorMessage", @OABordrinCommon.Common.GetLanguageValueByParam("输入的费用类别已经存在!", "ERCommon", "ERItemType", ViewBag.language)); return(Json(retModel, JsonRequestBehavior.AllowGet)); } Item item = null; if (string.IsNullOrEmpty(model.Id)) { item = inn.newItem("b_ExpenseCategory", "add"); } else { item = inn.newItem("b_ExpenseCategory", "edit"); item.setAttribute("id", model.Id); } item.setProperty("b_costname", model.b_CostName); item.setProperty("b_corresponsubject", model.b_CorresponSubject); var result = item.apply(); if (result.isError()) { retModel.AddError("errorMessage", result.getErrorString()); } } catch (Exception ex) { retModel.AddError("errorMessage", ex.Message); } return(Json(retModel, JsonRequestBehavior.AllowGet)); }
public expenseCategory TransformAnEntity(ExpenseCategoryBll entity) => Mapper.Map <ExpenseCategoryBll, expenseCategory>(entity);
public async Task Update(ExpenseCategoryBll elementToUpdate) { _unitOfWork.expenseCategoryUnitOfWork.Update(TransformAnEntity(elementToUpdate)); await _unitOfWork.Save(); }
public async Task Insert(ExpenseCategoryBll element) { _unitOfWork.expenseCategoryUnitOfWork.Insert(TransformAnEntity(element)); await _unitOfWork.Save(); }