public async Task <IActionResult> Create([Bind("ID,NAME,PASSWORD,USERNAME,TEL,ROLEID")] ehc_dv_user model) { if (ModelState.IsValid) { model.CDATE = DateTime.Now.ToDateTimeString(); model.UDATE = DateTime.Now.ToDateTimeString(); model.ISENBLED = 1; model.PASSWORD = ToolService.Instance.EncryptByDES(model.PASSWORD); await _respository.InsertAsync(model); await _respository.WriteUserLogger(this.GetUserID(), UserLoggerConfiger.AddUser, model.USERNAME); return(RedirectToAction(nameof(Index))); } await this.RefreshDropList(); return(View(model)); }
public async Task <IActionResult> Edit(string id, [Bind("ID,NAME,PASSWORD,USERNAME,TEL,ROLEID")] ehc_dv_user model) { if (id != model.ID.ToString()) { return(NotFound()); } if (ModelState.IsValid) { try { model.PASSWORD = ToolService.Instance.EncryptByDES(model.PASSWORD); await _respository.UpdateAsync(model); await _respository.WriteUserLogger(this.GetUserID(), UserLoggerConfiger.EditUser, model.USERNAME); } catch (DbUpdateConcurrencyException) { var result = await _respository.GetByIDAsync(id); if (result == null) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } await this.RefreshDropList(); return(View(model)); }