I have a table with some users waiting for approval, create a button called approve, by pressing it sends you to for example
link < - user ID
This is my view.
@{
ViewBag.Title = "Approved";
}
<h2>Approved</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-actions no-color">
<input type="submit" value="Aprobar" class="btn btn-default" /> |
@Html.ActionLink("Regresar", "Index", new { ViewBag.id })
</div>
}
This is my controller.
// GET: Collaborators/Approved/
public ActionResult Approved(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Collaborators collaborators = db.Collaborators.Find(id);
if (collaborators == null)
{
return HttpNotFound();
}
ViewBag.id = 1;
return View(collaborators);
}
I need to click on (Approve) to change only the status value of my database for a specific value in my case the number 2.
It should be clarified that the current status of an unapproved user is 1 and I want that when approving said value 1 changes to 2 for example.
This is the line in the model public int status { get; set; }