public async Task <ActionResult> DeleteConfirmed(Guid id)
 {
     try
     {
         await Service.DeleteAsync(id);
     }
     catch (DataException)
     {
         return(RedirectToAction("Delete", new { ID = id, saveChangesError = true }));
     }
     return(RedirectToAction("Index"));
 }
        public async Task <IActionResult> DeleteAsync(int id)
        {
            var result = await _assignmentService.DeleteAsync(id);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }
            var assignmentResource = _mapper.Map <Assignment, AssignmentResource>(result.Resource);

            return(Ok(assignmentResource));
        }