public static void DeleteToDb(this LinhVucThuTuc entity, DbContext context, string userName = null) { entity.IsDeleted = true; if (string.IsNullOrWhiteSpace(userName)) { entity.LastUpdatedBy = userName; } entity.LastUpdated = DateTime.Now; context.Entry(entity).State = EntityState.Modified; }
public static void UpdateToDb(this LinhVucThuTuc entity, LinhVucThuTucResult data, DbContext context) { entity.Ten = data.Ten; entity.MoTa = data.MoTa; entity.ParentId = data.ParentId; entity.IsDeleted = data.IsDeleted; entity.LastUpdatedBy = data.LastUpdatedBy; entity.LastUpdated = DateTime.Now; context.Entry(entity).State = EntityState.Modified; }