public async Task <ActionResult <Supplie> > PostSupplie(Supplie supplie)
        {
            _context.supplies.Add(supplie);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSupplie", new { id = supplie.Id }, supplie));
        }
        public async Task <IActionResult> PutSupplie(int id, Supplie supplie)
        {
            if (id != supplie.Id)
            {
                return(BadRequest());
            }

            _context.Entry(supplie).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SupplieExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Supplie supplie = db.Supplies.Find(id);

            db.Supplies.Remove(supplie);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "idSupplie,SupplieName,idSuplier,IDMEDIDATIPO")] Supplie supplie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supplie).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDMEDIDATIPO = new SelectList(db.MedidaTipoes, "IDMEDIDATIPO", "Nombre", supplie.IDMEDIDATIPO);
     ViewBag.idSuplier    = new SelectList(db.Suppliers, "idSuplier", "SuplierName", supplie.idSuplier);
     return(View(supplie));
 }
        // GET: Supplies/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Supplie supplie = db.Supplies.Find(id);

            if (supplie == null)
            {
                return(HttpNotFound());
            }
            return(View(supplie));
        }
Exemple #6
0
        public IActionResult DeleteItem(string id)
        {
            Supplie pom = new Supplie();

            foreach (Supplie s in FillModels.FillSupplies())
            {
                if (s.Id.ToString() == id)
                {
                    pom = s;
                }
            }
            pom.RemoveFromFile(pom);
            return(View());
        }
        // GET: Supplies/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Supplie supplie = db.Supplies.Find(id);

            if (supplie == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDMEDIDATIPO = new SelectList(db.MedidaTipoes, "IDMEDIDATIPO", "Nombre", supplie.IDMEDIDATIPO);
            ViewBag.idSuplier    = new SelectList(db.Suppliers, "idSuplier", "SuplierName", supplie.idSuplier);
            return(View(supplie));
        }
Exemple #8
0
        public IActionResult Edit(Supplie s)
        {
            foreach (Ingredient i in FillModels.FillIngredients())
            {
                if (s.Ingredient.Equals(i.Name))
                {
                    s.I = i;
                    break;
                }
            }
            s.Ingredient = null;
            if (ModelState.IsValid)
            {
                s.EditToFile(s);
                return(RedirectToAction("Index"));
            }

            return(View());
        }
        public Task SaveSupplie(Supplie supplie)
        {
            _supplies.InsertOneAsync(supplie);

            return(Task.CompletedTask);
        }