public async Task<IHttpActionResult> PostTracking(QrTracking tracking)
 {
     if (tracking==null || !ModelState.IsValid)
         return BadRequest(ModelState);
 
     await _repository.SaveTrackingAsync(tracking);
     return Ok();
 }
Exemplo n.º 2
0
 public async Task<int> SaveTrackingAsync(QrTracking tracking)
 {
     if (tracking.Id == 0)
     {
         context.QrTrackings.Add(tracking);
     }
     else
     {
         var dbEntry = context.QrTrackings.Find(tracking.Id);
         if (dbEntry != null)
         {
             dbEntry.OrderDate = tracking.OrderDate;
             dbEntry.MoNum = tracking.MoNum;
             dbEntry.QrShift = tracking.QrShift;
             dbEntry.QrOperators = tracking.QrOperators;
             dbEntry.QrComments = tracking.QrComments;
         }
     }
     return await context.SaveChangesAsync();
 }