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

            return(log);
        }