// [HttpPost, ActionName("Usuń")] // [ValidateAntiForgeryToken] public ActionResult Delete(int id) { Tranzakcje tranzakcje = _context.Tranzakcjes.Find(id); _context.Tranzakcjes.Remove(tranzakcje); _context.SaveChanges(); return(RedirectToAction("Historia")); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tranzakcje tranzakcje = _context.Tranzakcjes.Find(id); if (tranzakcje == null) { return(HttpNotFound()); } return(View(tranzakcje)); }
// [HttpPost] public ActionResult Buy(int prodId, string prodnaz, string prodcen) { string userID = User.Identity.GetUserId(); string date = DateTime.Today.ToString("yyyy-MM-dd"); Tranzakcje tranzakcje = new Tranzakcje(); tranzakcje.PrzedmiotId = prodId; tranzakcje.UserId = userID; tranzakcje.Date = date; tranzakcje.Nazwa = prodnaz; tranzakcje.Cena = prodcen; _context.Tranzakcjes.Add(tranzakcje); _context.SaveChanges(); return(Redirect("~/Przedmiots/Index")); }