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
Prakash
NA
258
77.6k
MVC - display data using ViewBag
May 7 2015 1:49 AM
hello...i am developing mvc5 base application.I want to display this type of data by using "ViewBag" ?
pl help me..thank u.
below is th piece of code..
public ActionResult GetQuestionsCountAndCurrent(Guid id)
{
var question = from x in db.Questions
where x.Chapter.Equals(id)
select x.Question1;
int totalQuestions = question.Count();
Guid userId = new Guid("FAA81C69-2D14-49EA-8C4C-6A440B2D78F6"); // get current user
var readQuestions = from y in db.UserProgresses
where y.Chapter.Equals(id) & y.UserID.Equals(userId)
select y.ReadQuestions;
int totalReadQuestions = 0;
foreach (string rdq in readQuestions)
{
totalReadQuestions = rdq.Split('#').Count();
}
string progress = totalReadQuestions.ToString() + "/" + totalQuestions.ToString();
return View(progress);
}
Reply
Answers (
1
)
Http post
How to encrypt a url in android using AES algorithm