Ejemplo n.º 1
0
        /// <summary>
        /// 浏览明细
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult BrowseDetail(int Id)
        {
            var model = new EM_ExpenseAccount_Detail();

            if (Id != 0)
            {
                model = expenseAccountDetailRepo.GetById(Id);
            }
            else
            {
                model.OccurDate = DateTime.Now;
            }
            InitSelect(model.CateId, model.CompanyId);
            return(PartialView("_BrowseDetail", model));
        }
Ejemplo n.º 2
0
        public ActionResult SaveDetail(EM_ExpenseAccount_Detail model)
        {
            model.Modifier   = ViewHelp.GetUserName();
            model.ModifyTime = DateTime.Now;
            if (model.Id == 0)
            {
                model.Creater    = ViewHelp.GetUserName();
                model.CreateTime = DateTime.Now;
                expenseAccountDetailRepo.Add(model);
            }
            else
            {
                var entity = expenseAccountDetailRepo.GetById(model.Id);
                Log(entity);
                entity = Mapper.Map <EM_ExpenseAccount_Detail, EM_ExpenseAccount_Detail>(model, entity);
            }
            var result = expenseAccountDetailRepo.SaveChanges();
            var dto    = Mapper.Map <EM_ExpenseAccount_Detail, ExpenseAccountDetailListDTO>(model);

            return(Json(new { code = result, message = "保存失败,请重试", model = dto }));
        }