public ActionResult Create(ReducaoZ reducaoz) { if (ModelState.IsValid) { reducaoz.CPF = usuario.CPF; reducaoz.DataVenda = DateTime.Now; db.ReducoesZ.Add(reducaoz); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CPF = new SelectList(db.Usuarios, "CPF", "Nome", reducaoz.CPF); ViewBag.CNPJ = new SelectList(db.Lojas, "CNPJ", "LojaNome", reducaoz.CNPJ); return View(reducaoz); }
public ActionResult Edit(ReducaoZ reducaoz) { if (ModelState.IsValid) { db.Entry(reducaoz).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CPF = new SelectList(db.Usuarios, "CPF", "Nome", reducaoz.CPF); ViewBag.CNPJ = new SelectList(db.Lojas, "CNPJ", "LojaNome", reducaoz.CNPJ); return View(reducaoz); }