List <HistorialOriginal> ListHistorialxMascota(string codigo)
        {
            HistorialOriginal        mascO   = ListHistorialOriginal().Where(x => x.ID_MASC == codigo).FirstOrDefault();
            List <HistorialOriginal> aPedido = new List <HistorialOriginal>();
            SqlCommand cmd = new SqlCommand("SP_LISTAHISTORIALXMASCOTA", cn);

            cmd.Parameters.AddWithValue("@MASC", codigo);
            cmd.CommandType = CommandType.StoredProcedure;
            cn.Open();

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                aPedido.Add(new HistorialOriginal()
                {
                    ID_HIST     = dr[0].ToString(),
                    ID_MASC     = dr[1].ToString(),
                    FEC_ATT     = DateTime.Parse(dr[2].ToString()),
                    ASUNTO      = dr[3].ToString(),
                    DESCRIPCION = dr[4].ToString(),
                    TRATAMIENTO = dr[5].ToString(),
                });
            }
            dr.Close();
            cn.Close();
            return(aPedido);
        }
        public ActionResult editarHistorial(string id)
        {
            HistorialOriginal mascO = ListHistorialOriginal().Where(x => x.ID_HIST == id).FirstOrDefault();

            ViewBag.mascota = new SelectList(ListMascota(), "ID_MASC", "NOMBRE");
            return(View(mascO));
        }
        public ActionResult editarHistorial(HistorialOriginal obju)
        {
            List <SqlParameter> parametros = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@IDHIST", SqlDbType = SqlDbType.Char, Value = obju.ID_HIST
                },
                new SqlParameter()
                {
                    ParameterName = "@IDMASC", SqlDbType = SqlDbType.Char, Value = obju.ID_MASC
                },
                new SqlParameter()
                {
                    ParameterName = "@FECAT", SqlDbType = SqlDbType.Date, Value = obju.FEC_ATT
                },
                new SqlParameter()
                {
                    ParameterName = "@ASUN", SqlDbType = SqlDbType.VarChar, Value = obju.ASUNTO
                },
                new SqlParameter()
                {
                    ParameterName = "@DESC", SqlDbType = SqlDbType.VarChar, Value = obju.DESCRIPCION
                },
                new SqlParameter()
                {
                    ParameterName = "@TRAT", SqlDbType = SqlDbType.VarChar, Value = obju.TRATAMIENTO
                }
            };

            ViewBag.mensaje = CRUD("SP_MANTENIMIENTOHISTORIAL", parametros);
            ViewBag.mascota = new SelectList(ListMascota(), "ID_MASC", "NOMBRE");
            return(RedirectToAction("listadoHistorial"));
        }
        public ActionResult listadoHistorialxMascota(string id)
        {
            HistorialOriginal mascO = ListHistorialOriginal().Where(x => x.ID_MASC == id).FirstOrDefault();

            return(View(ListHistorialxMascota(id)));
        }