Esempio n. 1
0
        public async Task <IActionResult> DeleteMachine([FromRoute] Guid id, CancellationToken ct)
        {
            if (!ModelState.IsValid || id == Guid.Empty)
            {
                return(BadRequest(ModelState));
            }

            await _service.DeleteAsync(id, ct);

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> Delete([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var machine = await _machineService.GetAsync(id);

            if (machine == null)
            {
                return(NotFound());
            }

            await _machineService.DeleteAsync(machine);

            return(RedirectToAction(nameof(Index)));
        }