public ActionResult Edit(UsersKnowledgeViewModel collection) { if (ModelState.IsValid) { try { service.Update(collection.ToDALUserKnowl()); if (Roles.Provider.IsUserInRole(Membership.GetUser().UserName, "Admin")) { return RedirectToAction("DetailsForAdmin", "Users"); } else { return RedirectToAction("Details", "Users", new { id = Membership.GetUser().ProviderUserKey }); } } catch { return View("Edit", collection); } } else { return View(); } }
public ActionResult Create(UsersKnowledgeViewModel mod) { if (ModelState.IsValid) { service.Create(mod.ToDALUserKnowl()); if (Roles.Provider.IsUserInRole(Membership.GetUser().UserName, "Admin")) { return RedirectToAction("DetailsForAdmin", "Users"); } else { return RedirectToAction("Details", "Users", new { id = Membership.GetUser().ProviderUserKey }); } } else { return View("Create", mod); } }