Hi 
 
This is my web api code like this :
 
 [Authorize]
    [RoutePrefix("api/Cards")]
    public class CardsController : ApiController
    {
        private Card _card = new Card();
        [HttpGet]
        [OverrideAuthorization]
        [Route("GetCard/{teamId}/metrics/{memberId}")]
        public List<CardData> GetCards(int teamId, int memberId)
        {
            //Send the list of cards associated with the team. Also send member previous rating and team average rating of past 7 days
            return _card.GetCardDetails(teamId, memberId);
        }
 
and this is my data access layer code :
 
public List<CardData> GetCardDetails(int teamid,int memberid)
        {
            var Getcard = (from c in _DataContext.uspGetCard(teamid, memberid) select new CardData { CardID = c.CardID, CardName = c.CardName, CardDescription = c.CardDescription, VoteValue = c.VoteValue, LastModifiedDateTime = c.LastModifiedDateTime }).ToList();
            return Getcard;
        } 
 
and this is my CardData Model code like this :
 
 public class CardData
    {
        public int CardID { get; set; }
        public string CardName { get; set; }
        public string CardDescription { get; set; }
        public CardRatingData CardRating { get; set; }
        public int VoteValue { get; set; }
        public DateTime LastModifiedDateTime { get; set; }
    }
 
and this is CardRatingData model code like this :
 
public class CardRatingData
    {
        public int MemberPreviousRating { get; set; }
        public DateTime MemberPreviousRatingDateTime { get; set; }
        public double TeamAverage7DayRating { get; set; }
    } 
 
how to get Team average 7 day rating based on vote table :
 
 this is my table structure like this :
 
 
i want to get last 7 days average vote value based on teamid and memberid using stored procedure.