TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
shreya kumrawat
NA
24
47.9k
Sequence contains more than one element in mvc
Feb 1 2015 1:46 PM
public ActionResult LogOn(GDCCollege.Models.StudentViewModel model, Attendance amodel)
{
if (ModelState.IsValid)
{
var v = db.Students.Where(a => a.Class.Equals(model.Class) && a.RollNo.Equals(model.RollNo)).FirstOrDefault();
if (v == null)
{
ViewBag.Message = "Invalid username and password";
}
else
{
Session["LogedId"] = v.Id.ToString();
Session["LogedStudentName"] = v.StudentName.ToString();
var vm = db.Attendances.Single(u => u.StudentId == v.Id);
//var vm = (from a in db.Attendances where a.StudentId == v.Id select a).Single();
if (vm != null)
{
Attendance viewmodel = new Attendance();
viewmodel.Subject = vm.Subject;
viewmodel.PrevMonthAttendance = vm.PrevMonthAttendance;
viewmodel.Semester1Attendance = vm.Semester1Attendance;
viewmodel.Semester2Attendance = vm.Semester2Attendance;
return RedirectToAction("StudentProfile", viewmodel);
}
else
{
ViewBag.Message = "Try Again";
}
}
}
return View(model);
}
There is an error occurred in this line where i highlight from green color..(sequence contain more than one element). so what do i do for it..I have multiple subjects attendence of single student.. and want o show on student profile view page.
Reply
Answers (
1
)
how to use splitter in asp.net in master pages.
count visits website in asp.net c# MVC4 rasor