示例#1
0
        // GET: CotacaoItemAutomovel/Create
        public ActionResult Create(int id)
        {
            CotacaoItemAutomovel item = new CotacaoItemAutomovel();

            item.Cotacao   = db.Cotacao.Include(c => c.Cliente).Include(c => c.Solicitante).Where(x => x.CotacaoId == id).FirstOrDefault();
            item.CotacaoId = item.Cotacao.CotacaoId;
            item.Cotacao.ItensAutomovel = db.CotacaoItemAutomovels.Where(x => x.CotacaoId == id).ToList();
            return(View(item));
        }
示例#2
0
        // GET: CotacaoItemAutomovel/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CotacaoItemAutomovel cotacaoItemAutomovel = db.CotacaoItemAutomovels.Find(id);

            db.CotacaoItemAutomovels.Remove(cotacaoItemAutomovel);
            db.SaveChanges();
            return(RedirectToAction("Create", "CotacaoItemAutomovel", new { id = cotacaoItemAutomovel.CotacaoId }));
        }
示例#3
0
        public ActionResult Create(CotacaoItemAutomovel cotacaoItemAutomovel)
        {
            if (ModelState.IsValid)
            {
                db.CotacaoItemAutomovels.Add(cotacaoItemAutomovel);
                db.SaveChanges();

                return(RedirectToAction("Create", new { id = cotacaoItemAutomovel.CotacaoId }));
            }
            else
            {
                return(View(cotacaoItemAutomovel));
            }
        }