// GET: racunTest/Edit/5
public ActionResult Edit(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
racun racun = db.racuns.Find(id);
if (racun == null)
{
return HttpNotFound();
}
ViewBag.kupac_id = new SelectList(db.kupacs, "id_kupac", "naziv", racun.kupac_id);
return View(racun);
}
// POST: racunTest/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include = "id_racun,dv_racuna,status,dv_placanja,kupac_id")] racun racun)
{
if (ModelState.IsValid)
{
db.Entry(racun).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
ViewBag.kupac_id = new SelectList(db.kupacs, "id_kupac", "naziv", racun.kupac_id);
return View(racun);
}
// GET: racunTest/Delete/5
public ActionResult Delete(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
racun racun = db.racuns.Find(id);
if (racun == null)
{
return HttpNotFound();
}
return View(racun);
}
// POST: racunTest/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(int id)
{
racun racun = db.racuns.Find(id);
db.racuns.Remove(racun);
db.SaveChanges();
return RedirectToAction("Index");
}
这个代码中是否有LINQ?它是什么,或者它都是LINQ。我必须使用LINQ从DB获取简单的数据,但它看起来很难,我甚至不知道应该在哪里,放置LINQ代码,以及如何显示数据? LINQ和LINQ to SQL是一回事吗?