I have anchor tag on header.cshtml when user login these links will display
The controller code:
[HttpGet]
public ActionResult update()
{
if (isUserLoggedIn)
{
using (var dbCntx = new dbEntity())
{
try
{
var updateInfo = (from row in dbCntx.users
where row.userId == SsnUserId
select new updateInfo
{
password = row.password,
firstName = row.firstName,
lastName = row.lastName,
middleName = row.middleName,
gender = row.gender.Value,
mobile = row.mobile,
dob = row.dob.Value
}).FirstOrDefault<updateInfo>();
return View(updateInfo);
}
catch (Exception ex)
{
var msg = ex.Message;
}
return View("");
}
}
else
{
return RedirectToAction("Index", "Home");
}
}
now the view that i am displaying
@model GenericWala.ViewModels.Account.updateInfo
@{
ViewBag.Title = "Genericwala - Indian Online Generic Pharmacy | Buy Generic Medicines Online | Hyderabad | Telengana | Andhra Pradesh | Fast Delivery | 4 Hours Delivery with in Hyderabad";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<section class="pagecontent-container">
@using (Html.BeginForm("update", "Account", FormMethod.Post, new { @id = "frmUpdate" }))
{
<div class="tag-title ">
<h2 class="product-name"> <i class="fa fa-info-circle"></i> Profile Info</h2>
</div>
<div class="register-form">
<div class="row">
<div class="col-md-6 ">
<h6>@Html.LabelFor(x => x.firstName)</h6>
<span>@Html.TextBoxFor(x => x.firstName, new { placeholder = "first name", @class = "form-control" })</span>
</div>
<div class="col-md-6 ">
<h6>@Html.LabelFor(x => x.lastName)</h6>
<span>@Html.TextBoxFor(x => x.lastName, new { placeholder = "last name", @class = "form-control" })</span>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h6>@Html.LabelFor(x => x.middleName)</h6>
<span>@Html.TextBoxFor(x => x.middleName, new { placeholder = "middle name", @class = "form-control" })</span>
</div>
<div class="col-md-6">
<h6>
<label>Gender</label>:</h6>
<div class="gender-radio radios row">
<div class="radio col-sm-2">
<input type="radio" id="male" name="gender" value="true" />
@Html.Label("male", "Male")
</div>
<div class="radio col-sm-2">
<input type="radio" id="female" name="gender" value="false" />
@Html.Label("female", "Female")
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-lg-6">
<h6>@Html.LabelFor(x => x.mobile)</h6>
<span>@Html.TextBoxFor(x => x.mobile, new { placeholder = "mobile", @class = "form-control" })</span>
</div>
<div class="col-md-6 col-lg-6">
<h6>@Html.LabelFor(x => x.dob)</h6>
<span>@Html.TextBoxFor(x => x.dob, "{0:MM/dd/yyyy}", new { @class = "form-control calender", @readonly = "true" })</span>
</div>
</div>
<div class="row">
<div class="col-md-12">
<button type="submit" class="pull-right btn-sm button btn-default pull-right" style="margin-top:15px;" onclick="Submit_OnClick();">Submit</button>
</div>
</div>
</div>
}
</section>