Ejemplo n.º 1
0
 public async Task UpdateAssetAsync(Asset asset)
 {
     using (var db = new ApplicationDbContext())
     {
         db.Assets.AddOrUpdate(asset);
         await db.SaveChangesAsync();
     }
 }
Ejemplo n.º 2
0
 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);
 }