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);
            }
        }
Ejemplo n.º 2
0
 // GET: Cars/Create
 public IActionResult Create()
 {
     ViewData["MarkaID"] = new SelectList(_context.Set <Marka>(), "ID", "naziv");
     return(View());
 }