public async Task <ActionResult> Add()
        {
            InitSelect();
            ViewBag.roleList = userRoleRepo.GetList();
            var model = new EM_Company_Performance();

            model.UploadDate = DateTime.Now;
            return(View(model));
        }
        public async Task <ActionResult> Add(EM_Company_Performance model)
        {
            model.CreateDate = DateTime.Now;
            model.Creater    = ViewHelp.GetUserName();
            model.ModifyDate = DateTime.Now;
            model.Modifier   = ViewHelp.GetUserName();
            companyPerformanceRepo.Add(model);
            var result = companyPerformanceRepo.SaveChanges();

            if (result > 0)
            {
                return(Json(new { code = 1, model = model }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { code = 0, message = "保存失败,请重试" }, JsonRequestBehavior.AllowGet));
            }
        }
        public async Task <ActionResult> Edit(EM_Company_Performance model)
        {
            var entity = companyPerformanceRepo.GetById(model.Id);

            if (model == null)
            {
                return(Json(new { code = 0, message = "业绩不存在!" }, JsonRequestBehavior.AllowGet));
            }
            Log(entity);
            entity            = Mapper.Map <EM_Company_Performance, EM_Company_Performance>(model, entity);
            entity.ModifyDate = DateTime.Now;
            entity.Modifier   = ViewHelp.GetUserName();
            var result = companyPerformanceRepo.SaveChanges();

            if (result > 0)
            {
                Log(model);
                return(Json(new { code = 1, model = model }));
            }
            else
            {
                return(Json(new { code = 0, message = "保存失败,请重试" }));
            }
        }