Esempio n. 1
0
 public async Task <IActionResult> End(Guid batchId, [FromForm] Batch batch)
 {
     if (batchId != batch.BatchId)
     {
         return(NotFound());
     }
     if (!ModelState.IsValid)
     {
         return(View(batch));
     }
     return(!await _logDb.BatchEnd(batch)
         ? (IActionResult)NotFound()
         : RedirectToAction(nameof(Index), new { batchId }));
 }
Esempio n. 2
0
        public async Task <Batch> BatchEnd(Guid batchId, [FromBody] Batch batch)
        {
            if (batch == null)
            {
                return new Batch()
                       {
                           StatusData = StatusData.Failure("No batch supplied")
                       }
            }
            ;
            if (batchId != batch.BatchId)
            {
                return(batch.Failure("Batch Id doesn't match route"));
            }
            if (!ModelState.IsValid)
            {
                return(batch.Failure("Model isn't valid"));
            }
            await _logDb.BatchEnd(batch);

            return(batch);
        }