Код: Выделить всё
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(SampleVM samplevm)
{
if (!IsUserInAuthorizedRole())
{
return View("~/Views/Shared/Unauthorized.cshtml");
}
if (ModelState.IsValid)
{
samplevm.UserId = User.Identity.Name;
Sample sample = PopulateSample(samplevm);
db.Entry(sample).State = EntityState.Modified;
db.SaveChanges();
TempData["Message"] = "Sample has been updated.";
//return RedirectToAction("Edit", "Samples", samplevm.SampleId);
return RedirectToAction("Index");
}
return View(samplevm);
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... login-page
Мобильная версия