public async Task UpdateAssetAsync(Asset asset) { using (var db = new ApplicationDbContext()) { db.Assets.AddOrUpdate(asset); await db.SaveChangesAsync(); } }
private async Task UpdateAsset(TaskCard taskCard, IIdentity identity) { var userId = identity.GetUserId<int>(); var isPull = taskCard.IsPull(); var card = taskCard.Card; var asset = new Asset { AssetType = card.AssetType, AssetPurpose = isPull ? AssetPurpose.Pull : AssetPurpose.Push, AssetValue = isPull ? card.PullValue : card.PushValue, UserId = userId, ModifiedBy = identity.Name, ModifiedOn = DateTime.Now, Date = DateTime.Today, DayOfWeek = (int) DateTime.Today.DayOfWeek }; await AssetRepository.UpdateAssetAsync(asset); }