예제 #1
0
        public ActionResult AwariaBlacharska(AwariaBlacharska model, int id)
        {
            if (ModelState.IsValid)
            {
                SamochodyPDEntities db = new SamochodyPDEntities();
                db.Entry(model).State = EntityState.Added;
                model.id_samochod     = id;
                db.SaveChanges();
                return(RedirectToAction("AwariaBlacharska", id));
            }

            return(RedirectToAction("AwariaBlacharska", id));
        }
예제 #2
0
        //----------------------------------------------------------------------------------------
        //AwariaBlacharska

        public ActionResult AwariaBlacharska(int id)
        {
            ViewBag.idSamochodu = id;
            SamochodyPDEntities db        = new SamochodyPDEntities();
            AwariaBlacharska    viewModel = new AwariaBlacharska();

            var sumaCena = db.AwariaBlacharska;

            ViewBag.koszt = (from m in sumaCena
                             where m.id_samochod == id
                             select m.cena).DefaultIfEmpty().Sum();

            ViewBag.lista = db.AwariaBlacharska.Where(a => a.id_samochod == id);
            return(View(viewModel));
        }