public CoachProfileDTO GetInfo(string login) { Coach coach = db.Coaches.Get(login); if (coach == null) { return(null); } CoachProfileDTO profile = new CoachProfileDTO(coach); List <CoachRate> coaches = db.Coaches .GetAll() .Select(x => new CoachRate(x)) .OrderByDescending(x => x.Points) .ToList(); int place = 1; foreach (CoachRate co in coaches) { if (profile.Rate.Points < co.Points) { place++; } else { profile.Rate.Place = place; } } return(profile); }
public CoachProfileDTO Info(string login) { CoachProfileService service = new CoachProfileService(services); CoachProfileDTO result = service.GetInfo(login); return(result); }