public IHttpActionResult Add(OfferModel offer)
        {
            if (!this.ModelState.IsValid)
            {
                return this.BadRequest("Invalid data");
            }

            var isFarmer = this.User.IsInRole("Farmer");

            if (!isFarmer)
            {
                return this.BadRequest("You are not farmer!");
            }

            var userName = this.User.Identity.Name;

            var product = this.data.Products.All()
                              .FirstOrDefault(p => p.Id == offer.ProductId);

            var newOffer = new Offer
            {
                Quantity = offer.Quantity,
                ProductPhoto = offer.ProductPhoto,
                PostDate = DateTime.Now,
                ProductId = offer.ProductId,
                Product = product
            };

            this.data.Offers.Add(newOffer);
            this.data.SaveChanges();

            var returnOffer = new
            {
                Id = newOffer.Id,
                Quantity = newOffer.Quantity,
                ProductPhoto = newOffer.ProductPhoto,
                PostDate = newOffer.PostDate,
                ProductId = newOffer.ProductId,
            };

            return this.Ok(returnOffer);
        }
        public IHttpActionResult Add(OfferModel offer)
        {
            if (!this.ModelState.IsValid)
            {
                return this.BadRequest(this.ModelState);
            }

            var product = this.data.Products.All().FirstOrDefault(p => p.Id == offer.ProductId);

            var newOffer = new Offer
            {
                Quantity = offer.Quantity,
                ProductPhoto = offer.ProductPhoto,
                PostDate = offer.PostDate,
                ProductId = offer.ProductId, 
                Product = product
            };

            this.data.Offers.Add(newOffer);
            this.data.SaveChanges();

            offer.Id = newOffer.Id;

            return this.Ok(newOffer);
        }