public ActionResult Edit(int id) { Together together = TogetherRepository.GetTogether(id); if (!together.IsHostedBy(User.Identity.Name)) { return(View("InvalidOwner")); } return(View(new TogetherFormViewModel(together))); }
public ActionResult Delete(int id, string confirmButton) { Together together = TogetherRepository.GetTogether(id); if (!together.IsHostedBy(User.Identity.Name)) { return(View("InvalidOwner")); } if (together == null) { return(View("NotFound")); } TogetherRepository.Delete(together); TogetherRepository.Save(); return(View("Deleted")); }
public ActionResult Delete(int id) { Together together = TogetherRepository.GetTogether(id); if (!together.IsHostedBy(User.Identity.Name)) { return(View("InvalidOwner")); } if (together == null) { return(View("NotFound")); } else { return(View(together)); } }
public ActionResult Edit(int id, FormCollection formValues) { Together together = TogetherRepository.GetTogether(id); if (!together.IsHostedBy(User.Identity.Name)) { return(View("InvalidOwner")); } try { UpdateModel(together); TogetherRepository.Save(); return(RedirectToAction("Details", new { id = together.TogetherID })); } catch { ModelState.AddRuleViolations(together.GetRuleViolations()); return(View(new TogetherFormViewModel(together))); } }