public async Task<ActionResult> Add(EM_Company_Limit model) { model.CreateDate = DateTime.Now; model.Creater = ViewHelp.GetUserName(); model.ModifyDate = DateTime.Now; model.Modifier = ViewHelp.GetUserName(); companyLimitRepo.Add(model); var result = companyLimitRepo.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_Limit model) { var entity = companyLimitRepo.GetById(model.Id); Log(entity); if (model == null) { return Json(new { code = 0, message = "额度不存在!" }, JsonRequestBehavior.AllowGet); } entity = Mapper.Map<EM_Company_Limit, EM_Company_Limit>(model, entity); entity.ModifyDate = DateTime.Now; entity.Modifier = ViewHelp.GetUserName(); var result = companyLimitRepo.SaveChanges(); if (result > 0) { Log(model); return Json(new { code = 1, model = model }); } else return Json(new { code = 0, message = "保存失败,请重试" }); }
public async Task<ActionResult> Add() { InitSelect(); var model = new EM_Company_Limit(); return View(model); }