public ActionResult Delete(int?activityPK) { IActivitiesRepository activitiesRepository = new ActivitiesRepository(db); if (activityPK != null) { Activity activity = activitiesRepository.GetActivityByPK((int)activityPK); activity.Deleted = true; activitiesRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("DELETE", activity.ActivityPK); } return(Redirect(Request.UrlReferrer.AbsoluteUri)); }
public ActionResult Edit(ActivityView activityView) { if (ModelState.IsValid) { IActivitiesRepository activitiesRepository = new ActivitiesRepository(db); Activity activity = activitiesRepository.GetActivityByPK((int)activityView.ActivityPK); activityView.ConvertTo(activityView, activity); activitiesRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("UPDATE", activity.ActivityPK); return(RedirectToAction("Index", "Activity")); } else { return(View(activityView)); } }