public StoreServiceResponse Create(StoreDomain store)
        {
            StoreServiceResponse response = new StoreServiceResponse();

            if (!validateIsNotExist(store.Id))
                response.Messages.Add(new Message("Data is already on database"));
            else
            {
                storeEntity = new Store();
                MergeExtension.Merge(storeEntity, store);
                _storeRepository.Add(storeEntity);
                _storeRepository.SaveChanges();
            }

            return response;
        }
        public StoreServiceResponse GetStoreById(Guid id)
        {
            StoreServiceResponse response = new StoreServiceResponse();
            Store store = _storeRepository.GetById(id);
            if (store == null)
            {
                response.Messages.Add(new Message("Data is not in Database"));
            }
            else
            {

                StoreDomain storeDomain = new StoreDomain();
                MergeExtension.Merge(storeDomain, store);
                response.StoreDomain = storeDomain;
            }
            return response;
        }
Beispiel #3
0
        public StoreServiceResponse GetStoreById(Guid id)
        {
            StoreServiceResponse response = new StoreServiceResponse();
            Store store = _storeRepository.GetById(id);

            if (store == null)
            {
                response.Messages.Add(new Message("Data is not in Database"));
            }
            else
            {
                StoreDomain storeDomain = new StoreDomain();
                MergeExtension.Merge(storeDomain, store);
                response.StoreDomain = storeDomain;
            }
            return(response);
        }
Beispiel #4
0
        public StoreServiceResponse Update(StoreDomain store)
        {
            StoreServiceResponse response = new StoreServiceResponse();

            if (!validateIsNotExist(store.Id))
            {
                response.Messages.Add(new Message("Data is not in Database"));
            }
            else
            {
                storeEntity = new Store();
                MergeExtension.Merge(storeEntity, store);
                _storeRepository.Update(storeEntity);
                _storeRepository.SaveChanges();
            }
            return(response);
        }
        public StoreServiceResponse GetAllStore()
        {
            StoreServiceResponse response = new StoreServiceResponse();
            Collection<Store> stores = _storeRepository.GetAll();

            if (stores.Count == 0)
            {
                response.Messages.Add(new Message("Tidak Ada Store Yang Terdaftar"));
            }
            else
            {
                foreach (var m in stores)
                {
                    StoreDomain storeDomain = new StoreDomain();
                    MergeExtension.Merge(storeDomain, m);
                    response.StoreDomains.Add(storeDomain);
                }
            }
            return response;
        }
Beispiel #6
0
        public StoreServiceResponse GetAllStore()
        {
            StoreServiceResponse response = new StoreServiceResponse();
            Collection <Store>   stores   = _storeRepository.GetAll();

            if (stores.Count == 0)
            {
                response.Messages.Add(new Message("Tidak Ada Store Yang Terdaftar"));
            }
            else
            {
                foreach (var m in stores)
                {
                    StoreDomain storeDomain = new StoreDomain();
                    MergeExtension.Merge(storeDomain, m);
                    response.StoreDomains.Add(storeDomain);
                }
            }
            return(response);
        }