I want to click a viewDetails button and show user profile. But I have faced an issue.
it's me get code
- public IActionResult UserDetail(int? UserId)-Here null userid
- {
- UserViewFullDetail obj_Detail = new UserViewFullDetail();
- try
- {
- var Result = (from UM in _context.UserProfileMaster
- join U in _context.UserMaster on UM.UserId equals U.UserId
- where UM.UserId == U.UserId
- where Convert.ToBoolean(UM.UserId == UserId)
- select new
- {
- UM.UserImage,
- UM.FirstName,
- UM.MobileNumber,
- UM.Country,
- UM.UserId,
- UM.ZipCode,
- UM.InstaUserName,
- UM.LevelBaseBall,
- UM.Address,
- U.Dob
- }).FirstOrDefault();
- if (Result != null)
- {
- obj_Detail.Name = Result.FirstName;
- DateTime dt = Convert.ToDateTime(Result.Dob);
- obj_Detail.DOB = string.Format("{0:dd MMMM yyyy}", dt);
- var Mob = Result.MobileNumber;
- obj_Detail.MobileNumber = String.Format("{0:##########}", double.Parse(Mob));
- obj_Detail.Country = Result.Country;
- obj_Detail.UserImage = Result.UserImage;
- obj_Detail.InstaUserName = Result.InstaUserName;
- obj_Detail.Address = Result.Address;
- obj_Detail.LevelBaseBall = Result.LevelBaseBall;
- it's me view code
- @model NBP_BaseBallAdmin.ViewModel.UserViewFullDetail
- @{
- ViewData["Title"] = "UserDetail";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- class="ms-content-wrapper categories">class="row">class="col-md-12">
- >
class="row">class="col-md-6">- class
- class
="breadcrumb-item">"">User Management- class
="breadcrumb-item active" aria-current="page">User Detailclass="col-md-6">class="invoice-buttons text-right">- "#" class="btn btn-danger" data-toggle="modal" data-target="#warning-user">Report User
class="ms-panel">class="ms-panel-header">class="d-flex justify-content-between">class="align-self-center align-left ">User Details
class="col-md-6">class="invoice-buttons text-right">- "player-stats.html" class="btn btn-dark mr-2">View Stats
- "update-user.html" class="btn btn-info">Update Profile
class="ms-panel-body">class="row">class="col-lg-3">class="master-img">" @Html.DisplayFor(x => x.UserImage)" alt="doctor-img">
class="col-lg-9">class="detail-sec">class="d-flex align-item-center justify-content-between">class
="bold text-capitalize">William Rose- class
- @Html.HiddenFor(x => x.UserId)
Instagram Username:
@Html.DisplayFor(x => x.InstaUserName)Date of Birth:
@Html.DisplayFor(x => x.DOB)Mobile no:
@Html.DisplayFor(x => x.MobileNumber)Country:
@Html.DisplayFor(x => x.Country)Level of Baseball:
@Html.DisplayFor(x => x.LevelBaseBall)Zipcode:
@Html.DisplayFor(x => x.ZipCode)Address:
@Html.DisplayFor(x => x.ZipCode)Please check this1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Varun SetiaPosted Aug 7, 2020, 4:07 AM