summaryrefslogtreecommitdiff
path: root/Project-Unite/Models/Group.cs
blob: da5b2773fe472294d6c305e7e87559d883e93885 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Project_Unite.Models
{
    public class Group
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public int Publicity { get; set; }
        public string BannerColorHex { get; set; }
        public string Description { get; set; }
        public string ShortName { get; set; }

        public double RawReputation { get; set; }

        public ApplicationUser[] Users
        {
            get
            {
                var db = new ApplicationDbContext();
                return db.Users.Where(x => x.GroupId == this.Id).ToArray();
            }
        }

        public int Reputation
        {
            get
            {
                return ((int)Math.Round(RawReputation));
            }
        }

    }
}