예제 #1
0
        public void Delete(int id)
        {
            var entity = _vehicleTypeRepository.GetById(id);

            _vehicleTypeRepository.Delete(entity);
            _unitofwork.Commit();
        }
예제 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            VehicleType vt = vtRep.GetById(id);

            vtRep.Delete(vt);
            return(RedirectToAction("Index"));
        }
        public IActionResult Delete([FromRoute] int id, [FromRoute] int page = 1, [FromRoute] int pagesize = 10)
        {
            var vehicleType = _VTypeRepo.GetVehicleType(id);

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

            _VTypeRepo.Delete(id);
            _VTypeRepo.Save();
            return(VTypesList(page, pagesize));
        }
예제 #4
0
        public IActionResult DeleteConfirm(int id)
        {
            var _vehicle = _vehicletypeRepository.GetById(id);

            _vehicletypeRepository.Delete(_vehicle);
            var statusDelete = _vehicletypeRepository.SaveChanges();

            if (statusDelete > 0)
            {
                TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Xoa thanh cong"));
                return(RedirectToAction("Create", "VehicleType"));
            }

            return(RedirectToAction("Index"));
        }
        public IActionResult Delete(long id)
        {
            try
            {
                var model = repository.GetById(id);

                if (model == null)
                {
                    return(BadRequest(Constants.ErrorMessages.NotFoundEntity));
                }

                repository.Delete(model);

                return(Accepted(Constants.ErrorMessages.DeleteSucess(1)));
            }
            catch (Exception ex)
            {
                logger.LogError(ex.GetExceptionMessages());
                return(StatusCode(StatusCodes.Status500InternalServerError, Constants.ErrorMessages.DeleteError));
            }
        }
예제 #6
0
        public async Task <object> Handle(DeleteVehicleTypeCommand command, CancellationToken cancellationToken)
        {
            var result = await _vehicleTypeRepository.Delete(command.Id);

            return(await Task.FromResult(result as object));
        }