// GET: FrontCamera public ActionResult Index() { dtbs15Entities db = new dtbs15Entities(); var ca = db.Front_Camera.ToList(); List <FrontCameraViewModel> fc = new List <FrontCameraViewModel>(); foreach (var c in ca) { FrontCameraViewModel b = new FrontCameraViewModel(); b.id = c.Id; b.Pixel = c.Pixel; fc.Add(b); } return(View(fc)); }
public ActionResult Create(FrontCameraViewModel Collection) { try { // TODO: Add insert logic here dtbs15Entities db = new dtbs15Entities(); Front_Camera fc = new Front_Camera(); fc.Pixel = Collection.Pixel; db.Front_Camera.Add(fc); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, FrontCameraViewModel collection) { try { // TODO: Add update logic here dtbs15Entities db = new dtbs15Entities(); Front_Camera fc = new Front_Camera(); var c = db.Front_Camera.Where(x => x.Id == id).SingleOrDefault(); c.Pixel = collection.Pixel; db.SaveChanges(); // TODO: Add update logic here return(RedirectToAction("Index")); } catch { return(View()); } }