public bool Add(T data) { try { //using (context=new Context()) { var T = context.Set <T>().Add(data); //context.Entry<T>(data).State = EntityState.Added; int result = context.SaveChanges(); return(result > 0 ? true : false); } } catch (Exception ex) { return(false); } }
// GET: Cars/Create public IActionResult Create() { ViewData["MarkaID"] = new SelectList(_context.Set <Marka>(), "ID", "naziv"); return(View()); }