public virtual async Task <TEntity> AlterAsync(TEntity entity) { var currentEntity = await GetByIdAsync(entity.Id).ConfigureAwait(false); _context.Entry(currentEntity).CurrentValues.SetValues(entity); await _context.SaveChangesAsync(); return(entity); }
public async Task <IActionResult> Create([Bind("TypeId,TypeCode,TypeText,TypeType")] MType mType) { if (ModelState.IsValid) { _context.Add(mType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(mType)); }