public async Task <IActionResult> Edit(int id, [Bind("IdDescripcion,IdReceta,Medicamento,Cantidad,Dosis")] DesReceta desReceta) { if (id != desReceta.IdDescripcion) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(desReceta); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DesRecetaExists(desReceta.IdDescripcion)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdReceta"] = new SelectList(_context.Receta, "IdReceta", "IdReceta", desReceta.IdReceta); return(View(desReceta)); }
public async Task <ActionResult <DesReceta> > PostDescripcionReceta(DesReceta exp) { _context.DesReceta.Add(exp); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDescripcionReceta", new { id = exp.IdDescripcion }, exp)); //return CreatedAtRoute("GetDocument",doc, null); }
public async Task <IActionResult> Create([Bind("IdDescripcion,IdReceta,Medicamento,Cantidad,Dosis")] DesReceta desReceta) { if (ModelState.IsValid) { _context.Add(desReceta); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdReceta"] = new SelectList(_context.Receta, "IdReceta", "IdReceta", desReceta.IdReceta); return(View(desReceta)); }