예제 #1
0
 public void AddBrand(Entity.Brand brand)
 {
     using (DBContext context = new DBContext())
     {
         context.brand.Add(brand);
         context.SaveChanges();
     }
 }
예제 #2
0
 public int Create(Brand item)
 {
     Entity.Brand brand = new Entity.Brand();
     brand.id   = item.id;
     brand.name = item.name;
     database.Brands.Add(brand);
     database.SaveChanges();
     return(1);
 }
예제 #3
0
        public ActionResult AddBrand(Models.Brand brand)
        {
            if (ModelState.IsValid)
            {
                Entity.Brand brandDetails = new Entity.Brand()
                {
                    BrandName = brand.BrandName,
                };
                mobileBL.AddBrand(brandDetails);
                return(RedirectToAction("Create"));
            }

            return(View());
        }
예제 #4
0
 public void AddBrand(Entity.Brand brand)
 {
     using (DBContext context = new DBContext())
     {
         using (var transaction = context.Database.BeginTransaction())
         {
             try
             {
                 SqlParameter BrandName = new SqlParameter("@BrandName", brand.BrandName);
                 var          result    = context.Database.ExecuteSqlCommand("Brand_Insert @BrandName ", BrandName);
                 transaction.Commit();
             }
             catch
             {
                 transaction.Rollback();
             }
         }
     }
 }
예제 #5
0
        public void AddBrand(Entity.Brand brand)
        {
            BrandRepository repository = new BrandRepository();

            repository.AddBrand(brand);
        }