public async Task <IActionResult> Edit(string id, ehc_dv_customer model) { if (id != model.ID.ToString()) { return(NotFound()); } if (ModelState.IsValid) { try { await _respository.UpdateAsync(model); await _respository.WriteUserLogger(this.GetUserID(), "编辑用户", model.NAME); } catch (DbUpdateConcurrencyException) { var result = await _respository.GetByIDAsync(id); if (result == null) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(model)); }
public async Task <IActionResult> Create(ehc_dv_customer model) { if (ModelState.IsValid) { await _respository.InsertAsync(model); await _respository.WriteUserLogger(this.GetUserID(), "添加用户", model.NAME); return(RedirectToAction(nameof(Index))); } return(View(model)); }