public void AddOffer(Offer offer)
        {
            EF.Execute("MySqlRepository.AddOffer",
                ctx =>
                    {
                        ctx.offers.AddObject(new offer()
                        {
                            start = offer.Start,
                            end = offer.End,
                            title = offer.Title,
                            imageUrl = offer.ImageUrl,
                            method = offer.Method,
                            offerType = offer.OfferType,
                            offerDetail = offer.OfferDetail,
                            stores = offer.Stores,
                            demog = offer.Demog,
                            text = offer.Text,
                            date = DateTime.UtcNow,
                            accountId = offer.AccountId
                        });
                        ctx.SaveChanges();
                        return offer;

                    }, null);
        }
        public HttpResponseMessage Put(Offer offer)
        {
            try
            {
                //_logger.Log("OfferController.Put", offer.Stringify());
                _repository.UpdateOffer(offer);
                return Request.CreateResponse(HttpStatusCode.OK, offer);
            }

            catch(Exception ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex);
            }
        }
 public void UpdateOffer(Offer offer)
 {
     EF.Execute("MySqlRepository.UpdateOffer",
         ctx =>
             {
                 var found = ctx.offers.First(o => o.id == offer.Id);
                 {
                     found.start = offer.Start;
                     found.end = offer.End;
                     found.imageUrl = offer.ImageUrl;
                     found.title = offer.Title;
                     found.method = offer.Method;
                     found.offerType = offer.OfferType;
                     found.stores = offer.Stores;
                     found.demog = offer.Demog;
                     found.text = offer.Text;
                     found.offerDetail = offer.OfferDetail;
                     found.accountId = offer.AccountId;
                     ctx.SaveChanges();
                     return offer;
                 }
             }, null);
 }