public async Task <ActionResult> DeleteConfirmed(short id) { TBL_CATEGORIA tBL_CATEGORIA = await db.TBL_CATEGORIA.FindAsync(id); db.TBL_CATEGORIA.Remove(tBL_CATEGORIA); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "cat_nombre,cat_id,cat_descripcion,cat_status,cat_fechacreacion")] TBL_CATEGORIA tBL_CATEGORIA) { if (ModelState.IsValid) { db.Entry(tBL_CATEGORIA).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tBL_CATEGORIA)); }
// GET: Categoria/Delete/5 public async Task <ActionResult> Delete(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TBL_CATEGORIA tBL_CATEGORIA = await db.TBL_CATEGORIA.FindAsync(id); if (tBL_CATEGORIA == null) { return(HttpNotFound()); } return(View(tBL_CATEGORIA)); }
public async Task <ActionResult> Create([Bind(Include = "cat_nombre,cat_id,cat_descripcion,cat_status,cat_fechacreacion")] TBL_CATEGORIA tBL_CATEGORIA) { if (ModelState.IsValid) { tBL_CATEGORIA.cat_fechacreacion = DateTime.Now; tBL_CATEGORIA.cat_status = "A"; db.TBL_CATEGORIA.Add(tBL_CATEGORIA); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tBL_CATEGORIA)); }
public static async Task <bool> updateCat(TBL_CATEGORIA _infoCategoria) { try { bool resultado = false; _infoCategoria.CAT_FECHA_CREACION = DateTime.Now; //Actualizar Datos await db.SaveChangesAsync(); resultado = true; return(resultado); } catch (Exception ex) { throw new ArgumentException("Error al modificar Categoria"); } }
public static async Task <bool> updateProduct(TBL_CATEGORIA _infoCategoria) { try { bool resultado = false; _infoCategoria.cat_fechacreacion = DateTime.Now; //Actualizar Contexto Datos await db.SaveChangesAsync(); resultado = true; return(resultado); } catch (Exception ex) { throw new ArgumentException("Error al consultar categoria"); } }
//ACTUALIZAR public static async Task <bool> updateCategoria(TBL_CATEGORIA _infoCategoria) { try { bool resultado = false; _infoCategoria.CAT_FECHA_CREACION = DateTime.Now; db.TBL_CATEGORIA.Add(_infoCategoria); await db.SaveChangesAsync(); resultado = true; return(resultado); } catch (Exception ex) { throw new ArgumentException("Error al consultar el proceso " + ex); } }
public static async Task <bool> deleteProduct(TBL_CATEGORIA _infoCategoria) { try { bool resultado = false; _infoCategoria.CAT_FECHACREACION = DateTime.Now; _infoCategoria.CAT_STATUS = "I"; //Actualizar Contexto Datos await db.SaveChangesAsync(); resultado = true; return(resultado); } catch (Exception ex) { throw new ArgumentException("Error al consultar categoria"); } }
//guardar categoria public static async Task <bool> saveCategory(TBL_CATEGORIA _infocategoria) { try { bool resultado = false; _infocategoria.cat_status = "A"; _infocategoria.cat_fechacreacion = DateTime.Now; db.TBL_CATEGORIA.Add(_infocategoria); //actualiza el contexto de datos await db.SaveChangesAsync(); resultado = true; return(resultado); } catch (Exception ex) { throw new ArgumentException("Error al consultar categoria"); } }
public static async Task <bool> deleteProduct(TBL_CATEGORIA _infoCategoria) { try { bool resultado = false; _infoCategoria.cat_fechacreacion = DateTime.Now; _infoCategoria.cat_status = "I"; //Eliminar de forma fisica delete from //db.TBL_CATEGORIA.Remove(_infoCategoria); //Actualizar Contexto Datos await db.SaveChangesAsync(); resultado = true; return(resultado); } catch (Exception ex) { throw new ArgumentException("Error al consultar categoria"); } }