public ActionResult DeleteConfirmed(int id) { Est_estoque est_estoque = db.Est_Estoque.Find(id); db.Est_Estoque.Remove(est_estoque); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Est_id,Est_quantidade_entrada,Est_quantidade_saida,Est_entrada,Est_saida,Est_motivo_saida,Est_valor_entrada,Est_data_vencimento,Pro_id")] Est_estoque est_estoque) { if (ModelState.IsValid) { db.Entry(est_estoque).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Pro_id = new SelectList(db.Pro_Produto, "Pro_id", "Pro_descricao", est_estoque.Pro_id); return(View(est_estoque)); }
public ActionResult Saida([Bind(Include = "Est_id,Est_quantidade_saida,Est_saida,Est_motivo_saida,Pro_id")] Est_estoque est_estoque) { if (ModelState.IsValid) { db.Est_Estoque.Add(est_estoque); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Pro_id = new SelectList(db.Pro_Produto, "Pro_id", "Pro_descricao", est_estoque.Pro_id); return(View(est_estoque)); }
public JsonResult CadastrarProdutos(List <getItens> dados, ConfigCesta config) { string nomecesta = ""; int cont = 0; double cont2 = 0; foreach (getItens gi in dados) { if (Convert.ToInt32(gi.Qtd) > 0) { if (nomecesta != gi.Identificacao) { nomecesta = gi.Identificacao; Ces_cesta cesta = new Ces_cesta(); cesta.Ces_nome = gi.Identificacao; cesta.Ces_criacao = DateTime.Now; cont2 += gi.Entregas; cesta.Ces_data_entrega = DateTime.Today.AddDays(cont2); cesta.Usu_id = 1; cesta.Ces_valor = gi.Total; cesta.Ass_id = 1; db.Ces_Cesta.Add(cesta); db.SaveChanges(); cont = cesta.Ces_id; } Cxp_cesta_produto a = new Cxp_cesta_produto(); a.Cxp_quantidade = Convert.ToInt32(gi.Qtd); a.Cxp_valor = gi.Valor; a.Pro_id = Convert.ToInt32(gi.Id); a.Ces_id = cont; db.Cxp_Cesta_Produto.Add(a); db.SaveChanges(); Est_estoque e = new Est_estoque(); e.Est_quantidade_saida = Convert.ToInt32(gi.Qtd); e.Est_saida = DateTime.Now; e.Est_motivo_saida = "comprado"; e.Pro_id = a.Pro_id; db.Est_Estoque.Add(e); db.SaveChanges(); } } return(Json("ok")); }
// GET: Est_estoques/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Est_estoque est_estoque = db.Est_Estoque.Find(id); if (est_estoque == null) { return(HttpNotFound()); } return(View(est_estoque)); }
// POST: Est_estoques/Create // Para se proteger de mais ataques, ative as propriedades específicas a que você quer se conectar. Para // obter mais detalhes, consulte https://go.microsoft.com/fwlink/?LinkId=317598. //[HttpPost] //[ValidateAntiForgeryToken] //public ActionResult Create([Bind(Include = "Est_id,Est_quantidade_entrada,Est_quantidade_saida,Est_entrada,Est_saida,Est_motivo_saida,Est_valor_entrada,Est_data_vencimento,Pro_id")] Est_estoque est_estoque) //{ // if (ModelState.IsValid) // { // db.Est_Estoque.Add(est_estoque); // db.SaveChanges(); // return RedirectToAction("Index"); // } // ViewBag.Pro_id = new SelectList(db.Pro_Produto, "Pro_id", "Pro_descricao", est_estoque.Pro_id); // return View(est_estoque); //} // GET: Est_estoques/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Est_estoque est_estoque = db.Est_Estoque.Find(id); if (est_estoque == null) { return(HttpNotFound()); } ViewBag.Pro_id = new SelectList(db.Pro_Produto, "Pro_id", "Pro_descricao", est_estoque.Pro_id); return(View(est_estoque)); }