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")); }
public ActionResult LisaSisenevAuto([Bind(Include = "Id, sisenemisMass, autoNr")] Auto auto) { if (ModelState.IsValid) { db.Autod.Add(auto); db.SaveChanges(); return(RedirectToAction("IndexAutod")); } return(View()); }
public virtual void Delete(T model) { using (var context = new AutoContext()) { context.Entry(model).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } }
public virtual void Create(T model) { using (var context = new AutoContext()) { context.Set <T>().Add(model); context.SaveChanges(); } }
public void SaveChanges() { AutoContext db = new AutoContext(); db.Category.AddItem(new Category() { CategoryCode = "cd", CategoryName = "dvd" }); db.SaveChanges(); }
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(); }
public void Create(RepoBrands item) { db.Brands.Add(item.FromRepoBrandsToBrands()); db.SaveChanges(); }
// Değişiklikleri Kaydet public void Save() { _dbcontext.SaveChanges(); }
public void Save() { db.SaveChanges(); }
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"); }
public void Create(RepoCar item) { db.Cars.Add(item.FromRepoCarToCar()); db.SaveChanges(); }