Ejemplo n.º 1
0
        public async Task <IHttpActionResult> getUsersMarker([FromBody] Group pass)
        {
            try
            {
                var g = await BL.GroupS.getGroupByPass(pass.Password);

                List <string>     users   = g.Users.Select(p => p.UserPhoneGroup).ToList();
                List <MarkerUser> markers = new List <MarkerUser>();
                foreach (var item in users)
                {
                    UserProfile user = await conectDB.getUser(item);

                    if (user != null)
                    {
                        var markerUser = new MarkerUser();
                        markerUser.image                 = user.Image;
                        markerUser.statusDistance        = user.Status;
                        markerUser.distanceLessManagment = await GroupS.getLessDistance(g.Password, user.Marker.Lat, user.Marker.Lng);

                        markerUser.marker = user.Marker;
                        markers.Add(markerUser);
                    }
                }

                return(Ok(markers));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> getManagmentsMarker([FromBody] Group pass)
        {
            try
            {
                var g = await BL.GroupS.getGroupByPass(pass.Password);

                List <string>     users   = g.ListManagment.Select(p => p.PhoneManagment).ToList();
                List <MarkerUser> markers = new List <MarkerUser>();
                foreach (var item in users)
                {
                    UserProfile user = await conectDB.getUser(item);

                    if (user != null)
                    {
                        MarkerUser marker = new MarkerUser();
                        marker.marker = user.Marker;
                        marker.image  = user.Image;
                        markers.Add(marker);
                        var man = g.ListManagment.Find(p => p.PhoneManagment == item);
                        marker.statusDistance = man.ComeToTrip;
                    }
                }


                return(Ok(markers));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.BadRequest, ex.Message));
            }
        }