public ActionResult Details(string id) { xe x = db.xes.FirstOrDefault(m => m.id_xe == id); Session["session_add_cart_index"] = false; return(View(x)); }
public void nhap() { Console.WriteLine("nhap vao ten nguoi thue:"); hoten = Console.ReadLine(); Console.WriteLine("nhap vao so gio thue:"); sogiothue = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("nhap vao kieu thue xe: nhap 1 la xe tai, 2 la xe du lich:"); int loaixe = Convert.ToInt32(Console.ReadLine()); if (loaixe == 1) { kieuxe = new xetai(); } else if (loaixe == 2) { kieuxe = new xedulich(); } }
public ActionResult add_xe(xe x, HttpPostedFileBase file) { string pic = null; if (file != null) { pic = System.IO.Path.GetFileName(file.FileName); string path = System.IO.Path.Combine(Server.MapPath("~/ProductImages/"), pic); file.SaveAs(path); } x.anh_xe = pic; db.Database.ExecuteSqlCommand("add_xe @ten_xe,@id_hang_xe,@id_loai_xe,@model_year,@gia_ban,@id_nsx,@anh_xe", new SqlParameter("@ten_xe", x.ten_xe), new SqlParameter("@id_hang_xe", x.id_hang_xe), new SqlParameter("@id_loai_xe", x.id_loai_xe), new SqlParameter("@model_year", x.model_year), new SqlParameter("@gia_ban", x.gia_ban), new SqlParameter("@id_nsx", x.id_nsx), new SqlParameter("@anh_xe", x.anh_xe) ); return(RedirectToAction("danh_sach_xe_dap")); }