Esempio n. 1
0
        public async Task <bool> Update(Offer offer, CancellationTokenSource token)
        {
            bool exists = await Repository.ExistAsync(offer.Id, token);

            if (exists)
            {
                B2COffer updateOffer = offer.AdapterOffer();
                var      result      = await Repository.UpdateAsync(updateOffer, token);

                if (offer.Image != null)
                {
                    await ServiceImage.UpdateAsync(offer.Image, token);
                }
                return(result);
            }
            else
            {
                string msg = String.Format(MessagesApplication.NotFoundCode, offer.Id);
                throw new BussinesException(msg, null);
            }
        }