public IActionResult Detalji(int id)
        {
            var clan = _clan.Get(id);

            var model = new ClanDetailModel
            {
                Prezime            = clan.Prezime,
                Ime                = clan.Ime,
                Adresa             = clan.Adresa,
                MaticnaKnjiznica   = clan.MaticnaKnjiznica.Naziv,
                Uclanjen           = clan.ClanskaIskaznica.DatumIzdavanja,
                Zakasnine          = clan.ClanskaIskaznica.Zakasnine,
                ClanskaIskaznicaId = clan.ClanskaIskaznica.Id,
                KontaktBroj        = clan.KontaktBroj,
                PosudjenaGradja    = _clan.GetPosudbe(id).ToList() ?? new List <Posudbe>(),
                PovijestPosudbi    = _clan.GetPovijestPosudbi(id),
                Rezervacije        = _clan.GetRezervacije(id)
            };

            return(View(model));
        }
示例#2
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var model = new ClanDetailModel();

            using (WotKitEntities db = new WotKitEntities())
            {
                var clan = db.Clans.Where(x => x.ClanId == id).Single();

                model.Name         = clan.Name;
                model.Abbreviation = clan.Abbreviation;
                model.ClanId       = clan.ClanId;
                model.EmblemSmall  = clan.EmblemSmall;

                var maxAsOfDate = db.ClanDetails.Where(x => x.ClanId == id).Max(x => x.AsOfDate);
                model.AsOfDate = maxAsOfDate;

                var members = from cd in db.ClanDetails
                              where cd.ClanId == id && cd.AsOfDate == maxAsOfDate
                              select new ClanMemberDetailModel
                {
                    Name           = cd.Player.Name,
                    Position       = cd.Rolei18n,
                    AllBattles     = cd.AllBattles,
                    ClanBattles    = cd.ClanBattles,
                    CompanyBattles = cd.CompanyBattles
                };
                model.ClanMembers = members.ToList();
            }

            return(View(model));
        }