예제 #1
0
        public void TestDeleteDishAsync()
        {
            RestaurantSeeder.SeedCountries();
            var bo         = new DishBusinessObject();
            var resList    = bo.ListAsync().Result;
            var resDelete  = bo.DeleteAsync(resList.Result.First().Id).Result;
            var resNotList = bo.ListUnDeletedAsync().Result;

            Assert.IsTrue(resDelete.Success && resNotList.Result.Count == 0);
        }
예제 #2
0
        public async Task <IActionResult> Remove(Guid id)
        {
            var result = await _bo.DeleteAsync(id);

            if (!result.Success)
            {
                return(InternalServerError(result.Exception));
            }
            return(Ok());
        }
예제 #3
0
        public void TestDeleteDishAsync()
        {
            ContextSeeders.Seed();
            var bo = new DishBusinessObject();

            var resList   = bo.List();
            var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result;

            resList = bo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
예제 #4
0
        public async Task <IActionResult> Delete(Guid?id)
        {
            if (id == null)
            {
                return(RecordNotFound());
            }
            var deleteOperation = await _bo.DeleteAsync((Guid)id);

            if (!deleteOperation.Success)
            {
                return(OperationErrorBackToIndex(deleteOperation.Exception));
            }
            else
            {
                return(OperationSuccess("The record was successfuly deleted"));
            }
        }
예제 #5
0
        public async Task <IActionResult> Delete(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var deleteOperation = await _bo.DeleteAsync((Guid)id);

            if (!deleteOperation.Success)
            {
                return(View("Error", new ErrorViewModel()
                {
                    RequestId = deleteOperation.Exception.Message
                }));
            }
            return(RedirectToAction(nameof(Index)));
        }