Beispiel #1
0
 public async Task <IActionResult> Edit(Guid batchId, [FromForm] Batch batch)
 {
     if (batchId != batch.BatchId)
     {
         return(NotFound());
     }
     if (!ModelState.IsValid)
     {
         return(View(batch));
     }
     return(!await _logDb.BatchSave(batch)
             ? (IActionResult)NotFound()
             : RedirectToAction(nameof(Index), new { batchId }));
 }
Beispiel #2
0
        public async Task <Batch> BatchUpdate(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.BatchSave(batch);

            return(batch);
        }