Exemplo n.º 1
0
        protected override async Task <bool> OnDelete(OfferModel offer)
        {
            bool ok;

            if (Offer.type == OfferType.Can)
            {
                ok = await CanService.DeleteCan(Offer.id);
            }
            else
            {
                ok = await WantService.DeleteWant(Offer.id);
            }

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

            return(ok);
        }
Exemplo n.º 2
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);
        }