4
4
CC#
Created by 4 on 9/4/2023 in #help
❔ im using models with tuple in razor view but it doesn't send data to action
with action ?
7 replies
CC#
Created by 4 on 9/4/2023 in #help
❔ im using models with tuple in razor view but it doesn't send data to action
what do you mean ?
7 replies
CC#
Created by 4 on 9/4/2023 in #help
❔ im using models with tuple in razor view but it doesn't send data to action
hi, I want to use multiple model in one razor view but data don't come to action from view
@{
Layout = null;
}

@model Tuple< LoginViewModel,RegisterViewModel,ResetPasswordViewModel>


<div id="log_in_container" class="log_in">
<div class="content">
<div class="modes">
<i class="fa-solid fa-moon"></i>
<i class="fa-solid fa-sun"></i>
</div>
<img class="site_logo"
onclick="location.href='../index.html'"
src="../assets/FITB_Game_logo.png"
alt="FITB Game logo" />
<form method="post" asp-action="Login" class="form" asp-route-returnUrl="@Context.Request.Query["ReturnUrl"]">

<div class="input_box">
<input asp-for="Item1.UserName" type="text" required />
<i>İstifadəçi Adı</i>
</div>

<div class="input_box">
<input asp-for="Item1.Password" type="password" required />
<i>Şifrə</i>
</div>
<div class="sign_in_links">
<a id="forgot_password" asp-controller="Account" asp-action="ForgotPassword">Şifrənizi unutmusunuz?</a>
<div>
<a id="sign_up" asp-controller="Account" asp-action="Register">Qeydiyyatdan keçin</a>
<i class="fa-solid fa-caret-right"></i>
</div>
</div>



<div class="input_box">
<button type="submit" value="Daxil ol">
Daxil ol
</button>
</div>

</form>
</div>
</div>
@{
Layout = null;
}

@model Tuple< LoginViewModel,RegisterViewModel,ResetPasswordViewModel>


<div id="log_in_container" class="log_in">
<div class="content">
<div class="modes">
<i class="fa-solid fa-moon"></i>
<i class="fa-solid fa-sun"></i>
</div>
<img class="site_logo"
onclick="location.href='../index.html'"
src="../assets/FITB_Game_logo.png"
alt="FITB Game logo" />
<form method="post" asp-action="Login" class="form" asp-route-returnUrl="@Context.Request.Query["ReturnUrl"]">

<div class="input_box">
<input asp-for="Item1.UserName" type="text" required />
<i>İstifadəçi Adı</i>
</div>

<div class="input_box">
<input asp-for="Item1.Password" type="password" required />
<i>Şifrə</i>
</div>
<div class="sign_in_links">
<a id="forgot_password" asp-controller="Account" asp-action="ForgotPassword">Şifrənizi unutmusunuz?</a>
<div>
<a id="sign_up" asp-controller="Account" asp-action="Register">Qeydiyyatdan keçin</a>
<i class="fa-solid fa-caret-right"></i>
</div>
</div>



<div class="input_box">
<button type="submit" value="Daxil ol">
Daxil ol
</button>
</div>

</form>
</div>
</div>
im using tuple for models
7 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
thats my first mvc project I have console and winform projects too
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
thank you again
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
I think I'll learn coding
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
I just learned that the word in the controller and in the view must be the same
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
why ?
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
thank u vey much
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
im crying
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
it is worked
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
damn
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
should i just write id instead of userId
53 replies
CC#
Created by 4 on 4/3/2023 in #help
✅ Im trying to send Id from view to controller but didn't work
[HttpGet]
public async Task<IActionResult> Profile(string id)
{
var user = await _userManager.FindByIdAsync(id);

var model = new ProfileViewModel
{
Id = user.Id,
FirstName = user.FirstName,
LastName = user.LastName,
Email = user.Email,
UserName = user.UserName,
ImagePath = user.ImagePath
};

var roles = await _userManager.GetRolesAsync(user);

if (roles.Any())
model.Role = roles[0];

return View(model);
}
[HttpGet]
public async Task<IActionResult> Profile(string id)
{
var user = await _userManager.FindByIdAsync(id);

var model = new ProfileViewModel
{
Id = user.Id,
FirstName = user.FirstName,
LastName = user.LastName,
Email = user.Email,
UserName = user.UserName,
ImagePath = user.ImagePath
};

var roles = await _userManager.GetRolesAsync(user);

if (roles.Any())
model.Role = roles[0];

return View(model);
}
53 replies