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
Guest User
Tech Writer
611
127.8k
Error in code a code.
Mar 24 2020 1:03 AM
public ActionResult AddFavourite(int? Favid, string Type)
{
FavouriteMang obj_favouriteman = new FavouriteMang();
tblSequence obj_tblSequence = new tblSequence();
int MaxOrderNumber = _db.tblSequences.Count();
if (Type == "Team")
{
var tblteam = _db.tblTeams.Where(u => u.Team_Id == Favid).FirstOrDefault();
tblteam.IsFavourite = true;
}
else if (Type == "League")
{
// FavouriteMang obj_favouriteman = new FavouriteMang();
try
{
if (Type == "Team")
{
var tblteam = _db.tblTeams.Where(u => u.Team_Id == Favid).FirstOrDefault();
tblteam.IsFavourite = true;
}
else if (Type == "League")
{
var tblleague = _db.tblLeagues.Where(u => u.LeagueId == Favid).FirstOrDefault();
tblleague.IsFavourite = true;
}
else if (Type == "Club")
{
var tblclub = _db.tblClubs.Where(u => u.ClubId == Favid).FirstOrDefault();
tblclub.IsFavourite = true;
}
_db.SaveChanges();
}
catch (Exception)
{
throw;
}
_db.SaveChanges();
obj_tblSequence.FavType = Type;
obj_tblSequence.IdFav = Favid;
obj_tblSequence.OrderNumber = MaxOrderNumber + 1;
_db.tblSequences.Add(obj_tblSequence);
_db.SaveChanges();
return View();
}
}
}
}
C# '': not all code paths return a value- this error show.
This is my code . Face a problem plzz solve error. ()
Reply
Answers (
2
)
roslyn analyser Microsoft.CodeAnalysis.CSharp
How to open the POPUP on hyperlink with Grid structure