示例#1
0
        public IEnumerable <MstStore> UpdateStore(MstStore store)
        {
            IEnumerable <MstStore> allStores = null;
            MstStore existingStore           = uow.StoreRepository.Get(store.Id);

            if (existingStore != null)
            {
                existingStore.Address      = store.Address;
                existingStore.AltPhone     = store.Address;
                existingStore.CityId       = store.CityId;
                existingStore.ModifiedBy   = this.GetUserId("");
                existingStore.IsActive     = store.IsActive;
                existingStore.ModifiedDate = DateTime.Now;
                existingStore.Name         = store.Name;
                existingStore.Phone        = store.Phone;
                existingStore.Pincode      = store.Pincode;

                // uow.update
                if (uow.Complete())
                {
                    allStores = GetAllStores();
                }
            }

            return(allStores);
        }
示例#2
0
 public HttpResponseMessage UpdateStores(MstStore store)
 {
     if (store != null)
     {
         return(Request.CreateResponse(HttpStatusCode.Accepted, StoreService.UpdateStore(store)));
     }
     else
     {
         return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, "Model is null."));
     }
 }
示例#3
0
        public IEnumerable <MstStore> DeleteStore(int storeId)
        {
            IEnumerable <MstStore> allStores = null;

            MstStore existingStore = uow.StoreRepository.Get(storeId);

            if (existingStore != null)
            {
                uow.StoreRepository.Remove(existingStore);
                if (uow.Complete())
                {
                    allStores = GetAllStores();
                }
            }

            return(allStores);
        }
示例#4
0
        public IEnumerable <MstStore> AddStore(MstStore store)
        {
            IEnumerable <MstStore> allStores = null;

            store.CreatedDate  = DateTime.Now;
            store.ModifiedDate = DateTime.Now;
            store.CreatedBy    = this.GetUserId("");
            store.ModifiedBy   = this.GetUserId("");
            uow.StoreRepository.Add(store);

            if (uow.Complete())
            {
                allStores = GetAllStores();
            }

            return(allStores);
        }