Beispiel #1
0
        public void Put(int id, T item)
        {
            var repo = new SimpleRepository <T>(connectionFactory);

            if (repo.Update(item) == false)
            {
                throw new HttpResponseException(System.Net.HttpStatusCode.NotFound);
            }
        }
Beispiel #2
0
        public void Update_Should_Match_All_Columns_For_Simple_Repo()
        {
            var p    = _db.Select.From <Product>().Where("ProductID").IsEqualTo(5).ExecuteSingle <Product>();
            var repo = new SimpleRepository(ProviderFactory.GetProvider(), SimpleRepositoryOptions.Default);

            p.ProductName = "Changed";
            repo.Update(p);

            //pull it again
            p = _db.Select.From <Product>().Where("ProductID").IsEqualTo(5).ExecuteSingle <Product>();
            Assert.Equal("Changed", p.ProductName);
        }
        public string UpdateStatus(string orderNo, int status)
        {
            var order = SimpleRepository.Single <Order>(s => s.OrderNo == orderNo);

            if (order != null)
            {
                switch (status)
                {
                case (int)OrderStatus.Created:
                    order.Status = OrderStatus.Created;
                    break;

                case (int)OrderStatus.Successed:
                    order.Status       = OrderStatus.Successed;
                    order.PurchaseDate = DateTime.Now;
                    break;

                case (int)OrderStatus.Failed:
                    order.Status       = OrderStatus.Failed;
                    order.PurchaseDate = DateTime.Now;
                    break;

                case (int)OrderStatus.Canceled:
                    order.Status = OrderStatus.Canceled;
                    break;

                case (int)OrderStatus.Expired:
                    order.Status = OrderStatus.Expired;
                    break;

                case (int)OrderStatus.Processing:
                    order.Status = OrderStatus.Processing;
                    break;

                case (int)OrderStatus.Stoped:
                    order.Status = OrderStatus.Stoped;
                    break;

                default:
                    break;
                }

                SimpleRepository.Update <Order>(order);
            }

            return(orderNo);
        }
 public virtual void Update <T>(T data) where T : class, new()
 {
     dataRespository.Update(data);
 }
Beispiel #5
0
 public int UpdateCalendar(Calendar data)
 {
     return(_rep.Update(data));
 }