Ejemplo n.º 1
0
        public IActionResult UrediSnimi(SjedisteUrediVM model)
        {
            MyContext db = new MyContext();
            Sjediste  s  = db.Sjediste.Where(x => x.SjedisteID == model.Id).Include(x => x.Sala).FirstOrDefault();

            s.SjedisteID = model.Id;
            s.Red        = model.Red;
            s.Kolona     = model.Kolona;
            List <SelectListItem> sale = db.Sala.Select(x => new SelectListItem()
            {
                Value = x.SalaID.ToString(),
                Text  = x.Naziv
            }).ToList();

            sale     = model.Sala;
            s.SalaID = model.salaId;
            db.SaveChanges();
            db.Dispose();
            return(RedirectToAction("Prikazi/" + model.Id));
        }
Ejemplo n.º 2
0
        public IActionResult Uredi(int id)
        {
            MyContext db = new MyContext();

            Sjediste        s     = db.Sjediste.Where(x => x.SjedisteID == id).Include(x => x.Sala).FirstOrDefault();
            SjedisteUrediVM model = new SjedisteUrediVM()
            {
                Id   = id,
                Sala = db.Sala.Select(x => new SelectListItem()
                {
                    Value = x.SalaID.ToString(),
                    Text  = x.Naziv
                }).ToList(),
                Kolona = s.Kolona,
                Red    = s.Red
            };

            db.Dispose();
            return(View(model));
        }