1
How do I make for the View
request only appear to the user, when the class confirmation Aprovacao
for true
.
Follows the logic:
1- user creates the request and register,
2- user awaits confirmation of the request made
3- if the request is approved
4- user can see the registered request
Models:
public class Solicitacao
{
public int SolicitacaoId { get; set; }
public bool Status { get; set; }
public string servico { get; set; }
}
I would like this class to confirm the request
public class Aprovacao
{
public int AprovacaoId { get; set; }
public string Aprova { get; set; }
public int SolicitacaoId { get; set; }
public virtual Solicitacao _Solicitacao{ get; set; }
}
View:
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Solicitacao</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Status, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<div class="checkbox">
@Html.EditorFor(model => model.Status)
@Html.ValidationMessageFor(model => model.Status, "", new { @class = "text-danger" })
</div>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Servico, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Servico, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Servico, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
What method would I use to make this confirmation in controller
approval?
Welcome Elói Ferreira. Also enter the code of your
view
. When possible do the [Tour] site to better understand the community.– George Wurthmann
Thanks, @Georgewurthmann! I’ve added to View
– Elói Ferreira
@Elóiferreira But at what point does this approval have to be made, it has to be approved by another system user? This flow is not very clear.
– Edney Batista da Silva
@Edneybatistadasilva In my case the user makes the request and Adm approves. I saw in some places that the application would have to persist in the bank anyway, right? And then I want the request to appear saved on the user screen, only when the Adm do is approved, before that when the request registration persists, a message appeared to the user to wait for the Adm approval.
– Elói Ferreira