/// <summary> /// Método para eliminar un registro de la DB DE GuillotinaEngrave /// </summary> /// <param name="Id_GuillitinaEngrave_"></param> /// <returns></returns> public int DeleteGuillotinaEngrave(int Id_GuillitinaEngrave_) { try { using (var conexion = new EntitiesTooling()) { GuillotinaEngrave_ data = conexion.GuillotinaEngrave_.Where(x => x.IdGuillotinaEngrave == Id_GuillitinaEngrave_).FirstOrDefault(); conexion.Entry(data).State = System.Data.Entity.EntityState.Deleted; return(conexion.SaveChanges()); } } catch (Exception) { return(0); } }
/// <summary> /// Método que inserta un nuevo registro en la BD de GuillotinaEngrave /// </summary> /// <param name="Codigo"></param> /// <param name="Dimension"></param> /// <param name="Detalle"></param> /// <returns></returns> public int SetGuillotinaEngrave_(string Codigo, double Dimension, string Detalle) { try { using (var conexion = new EntitiesTooling()) { GuillotinaEngrave_ data = new GuillotinaEngrave_(); float DimensionF = (float)Dimension; data.Codigo = Codigo; data.Dimension = DimensionF; data.Detalle = Detalle; conexion.GuillotinaEngrave_.Add(data); return(conexion.SaveChanges()); } } catch (Exception) { return(0); } }
/// <summary> /// Método que modifica un registro de la BD de GuillotinaEngrave_ /// </summary> /// <param name="IdGuillotinaEngrave_"></param> /// <param name="Codigo"></param> /// <param name="Dimension"></param> /// <param name="Detalle"></param> /// <returns></returns> public int UpdateGuillotinaEngrave_(int IdGuillotinaEngrave_, string Codigo, double Dimension, string Detalle) { try { using (var conexion = new EntitiesTooling()) { GuillotinaEngrave_ data = conexion.GuillotinaEngrave_.Where(x => x.IdGuillotinaEngrave == IdGuillotinaEngrave_).FirstOrDefault(); float DimensionF = (float)Dimension; data.Codigo = Codigo; data.Dimension = DimensionF; data.Detalle = Detalle; conexion.Entry(data).State = System.Data.Entity.EntityState.Modified; return(conexion.SaveChanges()); } } catch (Exception) { return(0); } }