Saludos tengo una vista con un CRUD en asp mvc y estoy intentando hacer un filtrado de fecha, mediante un procedure pero al momento de precionar el boton de filtrado me da el siguiente error:
The model item passed into the dictionary is of type 'System.Data.Entity.Core.Objects.ObjectResult
1[Pharmcom.Models.fechaUnion_Result]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
1[Pharmcom.Models.Union]'.
En la vista tengo: @model IEnumerable<Pharmcom.Models.Union>
Controlador:
public ActionResult Index()
{
PharmcomEntities DB = new PharmcomEntities();
return View(DB.Union.ToList());
}
[HttpPost]
public ActionResult Index(DateTime start, DateTime end)
{
//fechaUnion = procedure
PharmcomEntities DB = new PharmcomEntities();
return View(db.fechaUnion(start, end));
}
El modelo del procedure:
public partial class fechaUnion_Result
{
public int ID { get; set; }
public System.DateTime FECHA { get; set; }
public string NO_DOCUMENTO { get; set; }
public string ID_CLIENTE { get; set; }
public string NOMBRE_CLIENTE { get; set; }
public string ID_ARTICULO { get; set; }
public string DESCRIPCION { get; set; }
public decimal CANT { get; set; }
public string UND { get; set; }
public decimal PRECIO_VENTA { get; set; }
public decimal DESCUENTO { get; set; }
public decimal IMPUESTO { get; set; }
public string Nombre { get; set; }
public int PROVINCIA { get; set; }
public string Expr1 { get; set; }
public decimal VENTA { get; set; }
public int Region { get; set; }
}
modelo de la tabla:
public partial class Union
{
public int ID { get; set; }
public System.DateTime FECHA { get; set; }
public string NO_DOCUMENTO { get; set; }
public string ID_CLIENTE { get; set; }
public string NOMBRE_CLIENTE { get; set; }
public string ID_ARTICULO { get; set; }
public string DESCRIPCION { get; set; }
public decimal CANT { get; set; }
public string UND { get; set; }
public decimal PRECIO_VENTA { get; set; }
public decimal DESCUENTO { get; set; }
public decimal IMPUESTO { get; set; }
public string Nombre { get; set; }
public int PROVINCIA { get; set; }
public string Expr1 { get; set; }
public decimal VENTA { get; set; }
public int Region { get; set; }
}
@model
de la Vista?. Indica también el ModeloUnion
.