我需要从表中获取数据

时间:2019-07-08 19:37:04

标签: c# html .net

AdminController

public ActionResult UserDetails()         {             尝试             {

           var model2 = _db.People.Where(x => x.FullName != null);

            return View("/Views/Admin/UserDetails.cshtml",model2);
        }
        catch (Exception ex)
        { throw ex; }


    }

公共类PersonModel

    public int Id { get; set; }
    public string FullName { get; set; }
    public string EmailAddress { get; set; }
    public string Password { get; set; }
    public string ImageUrl { get; set; }
    public Nullable<int> ProfessionId { get; set; }
    public Nullable<System.DateTime> CreatedOn { get; set; }
    public Nullable<System.DateTime> UpdatedOn { get; set; }
    public Nullable<bool> IsDeleted { get; set; }
    public Nullable<long> FK_Role { get; set; }       

查看 @model Canva.Models.PersonModel

错误消息: 传递到字典中的模型项的类型为'System.Data.Entity.Infrastructure.DbQuery`1 [DataModel.Person]',但是此字典要求模型类型为'Canva.Models.PersonModel'。

0 个答案:

没有答案