コード例 #1
0
ファイル: AssetRepository.cs プロジェクト: yonglisyn/PushPull
 public async Task UpdateAssetAsync(Asset asset)
 {
     using (var db = new ApplicationDbContext())
     {
         db.Assets.AddOrUpdate(asset);
         await db.SaveChangesAsync();
     }
 }
コード例 #2
0
ファイル: TaskController.cs プロジェクト: yonglisyn/PushPull
 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);
 }