//编辑 public IActionResult Edit(int?id) { ReportEditModel model = new ReportEditModel(); if (id != null) { var report = reportRepository.GetById(id.Value); model = mapper.Map <ReportEditModel>(report); } return(View(model)); }
public IActionResult Edit(ReportEditModel model) { var report = mapper.Map <rpt_info>(model); if (model.ID > 0) { reportRepository.Update(report); } else { report.TestCount = 0; report.SearchCount = 0; reportRepository.Add(report); } reportRepository.SaveChanges(); return(View(model)); }