您好,基本上我想要一个下拉列表来显示员工姓名列表,当管理员或管理人员使用它时选择图表必须显示的名称。这可能吗?如果是这样,请帮助我...
public ActionResult CharterColumn()
{
var results = (from c in db.Clockcards select c);
// the employeeid is a foreign key in the clockcards table
// i want to get the name from the employee table
// and display only that employees hours worked for the months
var groupedByMonth = results
.OrderByDescending(x => x.CaptureDate)
.GroupBy(x => new { x.CaptureDate.Year, x.CaptureDate.Month }).ToList();
List<string> monthNames = groupedByMonth
.Select(a => a.FirstOrDefault().CaptureDate.ToString("MMMM"))
.ToList();
List<double> hoursPerMonth = groupedByMonth
.Select(a => a.Sum(p => p.Hours))
.ToList();
ArrayList xValue = new ArrayList(monthNames);
ArrayList yValue = new ArrayList(hoursPerMonth);
new Chart(width: 800, height: 400, theme: ChartTheme.Yellow)
.AddTitle("Chart")
.AddSeries("Default", chartType: "Column", xValue: xValue, yValues: yValue)
.Write("bmp");
return null;
}
这是我的观点
<div>
<img src= "@Url.Action("CharterColumn")" alt="Chart"/>
</div>