示例#1
0
        public ActionResult GetPackets()
        {
            if (Context == null || string.IsNullOrWhiteSpace(Context.UserId))
            {
                return(CreateResponse("Unauthorized"));
            }

            // Default behaviour => get from last week
            List <PacketFormatted> packets = dataCore.GetPacketsFormatted(ObjectId.Parse(Context.UserId), DateTime.Now.AddDays(-7), DateTime.Now);

            if (packets == null || packets.Count < 1)
            {
                return(CreateResponse("No data found"));
            }

            return(CreateResponse(data: JsonConvert.SerializeObject(packets), success: true));
        }