public async Task <IActionResult> Edit(int id, [Bind("BaseInfoGroupName,BaseInfoGroupText,Id")] BaseInfoGroup baseInfoGroup) { if (id != baseInfoGroup.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(baseInfoGroup); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BaseInfoGroupExists(baseInfoGroup.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(_mapper.Map <BaseInfoGroupViewModel>(baseInfoGroup))); }
private void UpdateRecord() { if (string.IsNullOrEmpty(TxtName.Text)) { return; } var baseInfoGroup = new BaseInfoGroup { Name = TxtName.Text, Comment = "", Text = txtText.Text, LogRecord = DateTime.Now, Status = 1, UserId = UtilityClass.UserId }; using (var dbContext = new UnitOfWork()) { baseInfoGroup.Id = BaseInfoGroupId; dbContext.BaseInfoGroupRepository.Update(baseInfoGroup); dbContext.Save(); DialogResult = DialogResult.OK; } }
public async Task <IActionResult> Create([Bind("BaseInfoGroupName,BaseInfoGroupText,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] BaseInfoGroup baseInfoGroup) { if (ModelState.IsValid) { _context.Add(baseInfoGroup); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(_mapper.Map <BaseInfoGroupViewModel>(baseInfoGroup))); }