public ActionResult Create(CADENA_LIBRERIAS cadena_librerias) { if (ModelState.IsValid) { db.CADENA_LIBRERIAS.Add(cadena_librerias); db.SaveChanges(); return RedirectToAction("Index"); } return View(cadena_librerias); }
public HttpResponseMessage PostCADENA_LIBRERIAS(CADENA_LIBRERIAS cadena_librerias) { if (ModelState.IsValid) { db.CADENA_LIBRERIAS.Add(cadena_librerias); db.SaveChanges(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, cadena_librerias); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = cadena_librerias.ID_LIBRERIA })); return response; } else { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } }
public HttpResponseMessage PutCADENA_LIBRERIAS(int id, CADENA_LIBRERIAS cadena_librerias) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } if (id != cadena_librerias.ID_LIBRERIA) { return Request.CreateResponse(HttpStatusCode.BadRequest); } db.Entry(cadena_librerias).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex); } return Request.CreateResponse(HttpStatusCode.OK); }
public ActionResult Edit(CADENA_LIBRERIAS cadena_librerias) { if (ModelState.IsValid) { db.Entry(cadena_librerias).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(cadena_librerias); }