Exemplo n.º 1
0
        public WasteContainerUpdateModel GetWasteContainerAsEditModel(Guid id)
        {
            var entity = _repository.Get(id);

            if (entity == null)
            {
                throw new Exception(LOCALIZATION_ENTITY_NOT_FOUND);
            }

            return(WasteContainerMapper.MapToWasteContainerEditModel(entity));
        }
Exemplo n.º 2
0
        public List <WasteContainerViewModel> GetWasteContainers()
        {
            var entities = _repository.GetAll();

            if (entities == null)
            {
                throw new Exception(LOCALIZATION_ENTITY_NOT_FOUND);
            }

            return(WasteContainerMapper.MapToWasteContainerViewModel(entities));
        }
Exemplo n.º 3
0
        public List <WasteContainerViewModel> GetWasteContainers(string columnName, string searchString)
        {
            List <WasteContainerDtoModel> entities;

            switch (columnName.ToLower())
            {
            case "name":
                entities = _repository.GetByWasteContainerName(searchString);
                break;

            default:
                entities = _repository.GetAll();
                break;
            }

            if (entities == null)
            {
                throw new Exception(LOCALIZATION_ENTITY_NOT_FOUND);
            }

            return(WasteContainerMapper.MapToWasteContainerViewModel(entities));
        }