public ActionResult gedimas_Create() { Gedima gedimas = new Gedima(); var list = db.Gedimo_busena.ToList(); var busenos = GetBusenosList(list); gedimas.busenos = busenos; return(View(gedimas)); }
public ActionResult gedimas_Create(Gedima gedimas) { Random rnd = new Random(); int id = rnd.Next(15, 999999999); gedimas.id_Gedimas = id; if (ModelState.IsValid) { db.Gedimas.Add(gedimas); db.SaveChanges(); } return(RedirectToAction("gedimas_List")); }
public ActionResult gedimas_Edit(int id) { Gedima gedimas = db.Gedimas.Find(id); if (gedimas == null) { return(HttpNotFound()); } var list = db.Gedimo_busena.ToList(); var busenos = GetBusenosList(list); gedimas.busenos = busenos; return(View(gedimas)); }
public ActionResult gedimas_List() { int i = 0; var gedimai = db.Gedimas.ToList(); Gedima g = new Gedima(); foreach (var gedimas in gedimai) { foreach (var busena in db.Gedimo_busena) { if (gedimas.busena == busena.id_Gedimo_busena) { gedimai.ElementAt(i).busenaString = busena.name; } } i++; } return(View(gedimai)); }