コード例 #1
0
ファイル: ComicDAL.cs プロジェクト: dandres10/PruebaTecnica
 private Comic Mapeador(IComicDTO de)
 {
     return(_ = new Comic
     {
         Nombre = de.Nombre,
         Autor = de.Autor,
         Fecha = de.Fecha,
         Id = de.Id
     });
 }
コード例 #2
0
ファイル: ComicDAL.cs プロジェクト: dandres10/PruebaTecnica
        public Respuesta <IComicDTO> ConsultarComic(IComicDTO comic)
        {
            using (connection = Contexto.GetInstance())
            {
                string query = string.Format(ComicQuery.ConsultarComic, comic.Id);
                using (command = new SQLiteCommand(query, connection))
                {
                    ExecuteRead(command);
                }
            }

            return(Respuesta);
        }
コード例 #3
0
ファイル: ComicDAL.cs プロジェクト: dandres10/PruebaTecnica
        private void RespuestaExitoso(IComicDTO comic)
        {
            List <IComicDTO> comics   = new List <IComicDTO>();
            List <string>    mensajes = new List <string>();

            mensajes.Add(Mensajes.AgregadoCorrectamente);
            comics.Add(comic);

            Respuesta.Mensajes         = mensajes;
            Respuesta.Entidades        = comics;
            Respuesta.Resultado        = true;
            Respuesta.TipoNotificacion = (int)TipoNotificacion.Exitoso;
        }
コード例 #4
0
ファイル: ComicDAL.cs プロジェクト: dandres10/PruebaTecnica
 private void ExecuteNonQuery(SQLiteCommand command, IComicDTO comic)
 {
     try
     {
         command.ExecuteNonQuery();
         RespuestaExitoso(comic);
         connection.Close();
     }
     catch (Exception error)
     {
         RespuestaFallido(error);
         connection.Close();
     }
 }
コード例 #5
0
ファイル: ComicDAL.cs プロジェクト: dandres10/PruebaTecnica
        public Respuesta <IComicDTO> GuadarComic(IComicDTO comic)
        {
            Comic comicObj = new Comic();

            using (connection = Contexto.GetInstance())
            {
                comicObj = Mapeador(comic);

                string query = ComicQuery.GuardarComic;
                using (command = new SQLiteCommand(query, connection))
                {
                    command.Parameters.Add(new SQLiteParameter("Id", comicObj.Id));
                    command.Parameters.Add(new SQLiteParameter("Nombre", comicObj.Nombre));
                    command.Parameters.Add(new SQLiteParameter("Autor", comicObj.Autor));
                    command.Parameters.Add(new SQLiteParameter("Fecha", comicObj.Fecha));

                    ExecuteNonQuery(command, comicObj);
                }

                return(Respuesta);
            }
        }
コード例 #6
0
 public Respuesta <IComicDTO> GuadarComic(IComicDTO comic)
 {
     return(ComicDAL.GuadarComic(comic));
 }
コード例 #7
0
 public Respuesta <IComicDTO> ConsultarComic(IComicDTO comic)
 {
     return(ComicDAL.ConsultarComic(comic));
 }