Esempio n. 1
0
        protected override async Task <bool> OnSave(OfferModel offer)
        {
            bool ok;

            if (Offer.type.Equals(_initialType))
            {
                if (_initialType.Equals(OfferType.Can))
                {
                    ok = await CanService.UpdateCan(Offer);
                }
                else
                {
                    ok = await WantService.UpdateWant(Offer);
                }
            }
            else
            {
                if (_initialType.Equals(OfferType.Can))
                {
                    ok = await CanService.DeleteCan(Offer.id);

                    if (ok)
                    {
                        ok = await WantService.CreateWant(Offer);
                    }
                }
                else
                {
                    ok = await WantService.DeleteWant(Offer.id);

                    if (ok)
                    {
                        ok = await CanService.CreateCan(Offer);
                    }
                }
            }

            return(ok);
        }
Esempio n. 2
0
        protected override async Task <bool> OnSave(OfferModel offer)
        {
            var img = Constants.ImagePlaceholderUrl + new Random().Next(1, 1000);

            Offer.imgurl = img;

            bool ok;

            if (Offer.type.Equals(OfferType.Can))
            {
                ok = await CanService.CreateCan(Offer);
            }
            else
            {
                ok = await WantService.CreateWant(Offer);
            }

            if (ok)
            {
                SendOfferActionMessage(MessengerOfferActionType.Create);
            }

            return(ok);
        }