예제 #1
0
        //   [HttpPost, ActionName("Usuń")]
        //  [ValidateAntiForgeryToken]
        public ActionResult Delete(int id)
        {
            Tranzakcje tranzakcje = _context.Tranzakcjes.Find(id);

            _context.Tranzakcjes.Remove(tranzakcje);
            _context.SaveChanges();
            return(RedirectToAction("Historia"));
        }
예제 #2
0
        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));
        }
예제 #3
0
        //     [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"));
        }