public IActionResult Delete(string id) { var dish = crudService.ReadById(id); if (dish == null) { return(NotFound()); } crudService.DeleteById(dish.Id); return(NoContent()); }
public void TestDeleteById() { // Arrange var dish1 = new Dish( "Eis", "Ice cream", 2.0M, Category.Dessert, TimeOfDay.Weekdays, true, 2 ); var dish2 = crudService.Create(dish1); Assert.NotNull(dish2); // Act crudService.DeleteById(dish2.Id); // Assert var dish3 = crudService.ReadById(dish2.Id); Assert.Null(dish3); }
public IActionResult DeleteIssue(int id) { issueService.DeleteById(id); try { context.SaveChanges(); return(Ok(new DtoOutput <int>(0, "Deleted successfully", 0))); } catch (Exception ex) { return(BadRequest(new DtoOutput <int>(0, "Cannot delete the issue", ErrorCode.ISSUE_DELETE_FAILED))); } }
public IActionResult DeleteDepartment(int id) { departmentService.DeleteById(id); context.SaveChanges(); return(Ok(new DtoOutput <int>(0))); }
public IActionResult DeleteSubCategory(int id) { subCategoryService.DeleteById(id); context.SaveChanges(); return(Ok(new DtoOutput <int>(0))); }
public string Delete(string id) { _curdService.DeleteById(ObjectId.Parse(id)); return("deleted...!!!"); }