Ejemplo n.º 1
0
        public async Task <IEnumerable <Expedition> > GetAll()
        {
            var items = await GetAllParseExpeditions();

            var expeditions = items.ToList().Select(p => ExpeditionMapper.Map(p));

            return(expeditions);
        }
Ejemplo n.º 2
0
        public async Task <IList <Expedition> > GetByUser(string user)
        {
            var query = from item in ParseObject.GetQuery("Expedition")
                        where item.Get <string>("username") == user
                        select item;

            IEnumerable <ParseObject> items = await query.FindAsync();

            var expeditions = items.ToList().Select(p => ExpeditionMapper.Map(p));

            return(expeditions.ToList());
        }
Ejemplo n.º 3
0
        public async Task <Expedition> GetCurrent(string user)
        {
            var query = from item in ParseObject.GetQuery("Expedition")
                        where item.Get <int>("current") == 1 && item.Get <string>("username") == user
                        select item;

            ParseObject parseObject = await query.FirstAsync();

            var expedition = ExpeditionMapper.Map(parseObject);

            return(expedition);
        }
Ejemplo n.º 4
0
        async Task <Expedition> IRepository <Expedition> .Insert(Expedition entity)
        {
            ParseObject expedition = new ParseObject("Expedition");

            expedition["name"]             = entity.Name;
            expedition["description"]      = entity.Description;
            expedition["beginDate"]        = entity.StartDate;
            expedition["endDate"]          = entity.EndDate;
            expedition["startSystem"]      = entity.StartSystem;
            expedition["endSystem"]        = "none";
            expedition["username"]         = entity.User;
            expedition["current"]          = entity.Current ? 1 : 0;
            expedition["profit"]           = 0;
            expedition["totalDistance"]    = 0;
            expedition["scanCountTotal"]   = 0;
            expedition["systemVisitCount"] = 0;
            await expedition.SaveAsync();

            return(ExpeditionMapper.Map(expedition));
        }