public async Task <IActionResult> Delete(string id) { string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; var oldPlan = await _planService.GetPlanByIdAsync(id, userId); if (oldPlan == null) { return(NotFound()); } string fullPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", oldPlan.CoverPath.Replace(_configuration["AppUrl"], "")); System.IO.File.Delete(fullPath); var deletedPlan = await _planService.DeletePlanAsync(id, userId); return(Ok(new OperationResponse <Plan> { IsSuccess = true, Message = $"{oldPlan.Title} has been deleted successfully", OperationDate = DateTime.UtcNow, Record = oldPlan, })); }