命名空间'myMVCApplication'中不存在类型或命名空间名称'ViewModels'(您是否缺少程序集引用?)

时间:2012-01-27 08:23:50

标签: asp.net-mvc razor

我正在尝试开发Mvc应用程序,但是 在尝试运行时,我总是得到我在主题中提到的信息。

这是引用它的视图内容。

@model myMVCApplication.ViewModels.FormData

@{
    ViewBag.Title = "Index";
}


<table>
  <tr>
    <th>Tanggal</th>
    <th>Satelit</th>
    <th>Pembicara</th>
    <th>Worship Manager</th>
  </tr>

@{DateTime LastDate = @DateTime.Now.Date;}
@foreach (var f in Model.Forms)
{
  <tr>
    <td>
       <span>
          @if (LastDate != f.Tanggal)
          {
             LastDate = @f.Tanggal;
             @String.Format("{0:dd MMM yyyy}", f.Tanggal)<br />
          }
       </span>
    </td>

    <td>

        @if (f.satelite != null)
        {
            @f.satelite.SateliteName;
        }
     </td>

    <td>@f.Pembicara;</td>
    <td>@f.WorshipManager</td>
  </tr>    
}
</table>

这里是FormData类的内容:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using myMVCApplication.Models;

namespace myMVCApplication.ViewModels
{
    public class FormData
    {
        public IEnumerable<Form> Forms { get; set; }
        public IEnumerable<Satelite> Satelites { get; set; }
    }
}

我试图为此搜索解决方案,并找到了几个链接,包括stackoverflow,但没有什么可以解决我的问题。 如果它没有表示ViewModel的程序集引用,它已经在我的应用程序中。 我检查了咒语,一切都好。 你能不能给我一个暗示? 提前谢谢。

0 个答案:

没有答案