well , I am new to MVC5 and i have two issues and your help will be appreciated. the first one is :- have tow models one for voteadmin to set an election date and election id and one is for the employees i named it votingmodel, now we have already accepted the data of election from employees and i want to retrieve all the data when the election.id is equal to integer, for example 55. i have assigned to votingmodel electionDetails all the data like election id candidate name , employee name, estatus and other columns now i want to retrieve candidate name, date, reasonoforelecting, from the table for all rows containg the electionid 55
here is the model votingmodel
    public virtual int EmployeeId { get; set; }
    public virtual int ElectionId { get; set; }
    public virtual string ElectionName { get; set; }
    public virtual DateTime EEnd { get; set; }
    public virtual string CandidateName { get; set; }
    public virtual int Estatus { get; set; }
    public string EPosition { get; set; }
    public virtual string EDepartment { get; set; }
    public virtual string EDescription { get; set; }
i want to display in the table election id, name, estatus,department,position from all the rows table electiondetails when electionid =55 and see how many comments i have tried many methods but i couldnt get it
in the controller model i have
        public ActionResult Index() 
        {
            return View();
        }
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Index(votingModel chk)
        {
            var id = chk.ElectionId;
            string ids = Convert.ToString(id);
            if (db.votingModels.Find(id) == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            //votingModel votingModel = db.votingModels.Find(id);
            if (id == null)
            {
                return HttpNotFound();
            }
            //var result = db.votingModels.Include("ElectionName").Where(p => p.ElectionId)
            //db.votingModels = db.votingModels.Contains(id)
            //model.Customers = db.Customers.OrderBy(
            //           m => m.CustomerID).Take(5).ToList();
            var query = from a in db.votingModel
                        where SqlFunctions.StringConvert((double)a.ElectionId).Contains(id)
                        select a;
            var item = query.FirstOrDefault();
            if (item != null)
            {
                return View(item);
            }
            else
            {
                return View("NotFound");  //Let's show a view about item not found
            }
            return View(votingModel);
        }
in the view model i have this code
    @model election.Models.votingModel
    @{
        ViewBag.Title = "index";
    }
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        @*<p>
            @Html.ActionLink("Create New", "Create")
        </p>*@
        @Html.Label("election ID", htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.TextBoxFor(model => model.ElectionId, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.ElectionId, "", new { @class = "text-danger" })
        </div>
        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="submit" class="btn btn-default" />
            </div>
        </div>
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.ElectionId)
        </dt>
    <dd>
        @Html.DisplayFor(model => model.ElectionId)
    </dd>
    <dt>
        @Html.DisplayNameFor(model => model.ElectionName)
    </dt>
    <dd>
        @Html.DisplayFor(model => model.ElectionName)
    </dd>
    <dt>
        @Html.DisplayNameFor(model => model.EStart)
    </dt>
    <dd>
        @Html.DisplayFor(model => model.EStart)
    </dd>
    <dt>
        @Html.DisplayNameFor(model => model.Estatus)
    </dt>
    <dd>
        @Html.DisplayFor(model => model.Estatus)
    </dd>
    <dt>
        @Html.DisplayNameFor(model => model.EPosition)
    </dt>
    <dd>
        @Html.DisplayFor(model => model.EPosition)
    </dd>
    <dt>
        @Html.DisplayNameFor(model => model.EDepartment)
    </dt>
    <dd>
        @Html.DisplayFor(model => model.EDepartment)
    </dd>
    <dt>
        @Html.DisplayNameFor(model => model.EDescription)
    </dt>
    <dd>
        @Html.DisplayFor(model => model.EDescription)
    </dd>
</dl>
}
the second issue is if i want to check of three conditions
i want to check if the employee has already voted
if electionid entered by the user exist in database andand employeedid is exist in same row andand estatus exist and = 2 means he already voted how can i make that condition.
thanks all
 
     
    