Example #1
0
        public ActionResult Contact(HttpPostedFileBase upload, string Name, string CarBrand, int Count_Of_Unit, double Price, string Info)
        {
            if (upload != null)
            {
                string fileName = Path.GetFileName(upload.FileName);
                string ext      = Path.GetExtension(fileName);
                upload.SaveAs(Server.MapPath("~/Files/" + Name + ext));
                //byte[] avatar = new byte[upload.ContentLength];
                //upload.InputStream.Read(avatar, 0, upload.ContentLength);
                //string ext = Name + ".jpg";
                Car car = new Car(Name, CarBrand, Count_Of_Unit, Price);
                if (Info != null)
                {
                    car.Info = Info;
                }
                else
                {
                    car.Info = "gg";
                }

                car.ExtencionName = Name + ext;
                db.Cars.Add(car);
                db.SaveChanges();
            }
            return(View("Index"));
        }
Example #2
0
 public ActionResult LisaSisenevAuto([Bind(Include = "Id, sisenemisMass, autoNr")] Auto auto)
 {
     if (ModelState.IsValid)
     {
         db.Autod.Add(auto);
         db.SaveChanges();
         return(RedirectToAction("IndexAutod"));
     }
     return(View());
 }
Example #3
0
 public virtual void Delete(T model)
 {
     using (var context = new AutoContext())
     {
         context.Entry(model).State = System.Data.Entity.EntityState.Deleted;
         context.SaveChanges();
     }
 }
Example #4
0
 public virtual void Create(T model)
 {
     using (var context = new AutoContext())
     {
         context.Set <T>().Add(model);
         context.SaveChanges();
     }
 }
Example #5
0
        public void SaveChanges()
        {
            AutoContext db = new AutoContext();

            db.Category.AddItem(new Category()
            {
                CategoryCode = "cd", CategoryName = "dvd"
            });
            db.SaveChanges();
        }
Example #6
0
        public void Update()
        {
            OrmEngine.Instance().InitializeDatabase();
            AutoContext        db         = new AutoContext();
            DAIList <Category> categories = db.Category.ToList();
            Category           category   = categories[0];

            category.CategoryName = "pc3";

            db.Category.Update(category);
            //provider.Update(new Product() { Id = 2, ProductCode = "Ali", ProductName= "Kaya" });
            db.SaveChanges();
        }
Example #7
0
 public void Create(RepoBrands item)
 {
     db.Brands.Add(item.FromRepoBrandsToBrands());
     db.SaveChanges();
 }
Example #8
0
 // Değişiklikleri Kaydet
 public void Save()
 {
     _dbcontext.SaveChanges();
 }
Example #9
0
 public void Save()
 {
     db.SaveChanges();
 }
Example #10
0
 public void Create(RepoBuyer item)
 {
     db.Buyers.Add(item.FromRepoBuyerToBuyer());
     db.SaveChanges();
 }
 public IHttpActionResult PostDeleteAll()
 {
     var context = new AutoContext();
     var contextAuto = context.Cars;
     foreach (var item in contextAuto)
     {
         contextAuto.Remove(item);
     }
     context.SaveChanges();
     return Ok("All cars deleted");
 }
Example #12
0
 public void Create(RepoCar item)
 {
     db.Cars.Add(item.FromRepoCarToCar());
     db.SaveChanges();
 }