Exemplo n.º 1
0
        //сохранение товара
        private async void SaveGoods(object goodsObject)
        {
            tdGoods goods = goodsObject as tdGoods;

            if (goods != null)
            {
                IsBusy = true;
                // редактирование
                if (goods.tdGoodsID > 0)
                {
                    tdGoods updGoods = await mobileService.Update(goods);

                    // заменяем объект в списке на новый
                    if (updGoods != null)
                    {
                        int pos = Goods.IndexOf(updGoods);
                        Goods.RemoveAt(pos);
                        Goods.Insert(pos, updGoods);
                    }
                }
                // добавление
                else
                {
                    tdGoods addedGoods = await mobileService.Add(goods);

                    if (addedGoods != null)
                    {
                        Goods.Add(addedGoods);
                    }
                }
                IsBusy = false;
            }
            Back();
        }
Exemplo n.º 2
0
        public Message GetGeoContext()
        {
            SvcContext ctx = InflateContext(); if (ctx.Invalid)
            {
                return(ctx.ContextMessage);
            }

            var places = new MobileService().GetNearestLocationsV1(ctx.Lat, ctx.Lon, 12);
            var areas  = new GeoService().GetIntersectingAreasOfPoint(ctx.Lat, ctx.Lon);

            foreach (var a in areas)
            {
                places.Add(new LocationResultDto(a.ID, a.TypeID, a.CountryID, a.Name, a.NameShort, a.Avatar, a.Latitude, a.Longitude,
                                                 0, a.Rating, a.RatingCount));
            }

            return(ReturnAsJson(places));
        }