コード例 #1
0
        public IActionResult Delete(string id)
        {
            var dish = crudService.ReadById(id);

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

            crudService.DeleteById(dish.Id);

            return(NoContent());
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 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)));
     }
 }
コード例 #4
0
 public IActionResult DeleteDepartment(int id)
 {
     departmentService.DeleteById(id);
     context.SaveChanges();
     return(Ok(new DtoOutput <int>(0)));
 }
コード例 #5
0
 public IActionResult DeleteSubCategory(int id)
 {
     subCategoryService.DeleteById(id);
     context.SaveChanges();
     return(Ok(new DtoOutput <int>(0)));
 }
コード例 #6
0
 public string Delete(string id)
 {
     _curdService.DeleteById(ObjectId.Parse(id));
     return("deleted...!!!");
 }