public ActionResult DeleteConfirmed(int id) { ProfitCenter profitCenter = db.ProfitCenters.Find(id); db.ProfitCenters.Remove(profitCenter); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ProfitCenterID,ProfitCenterDescription")] ProfitCenter profitCenter) { if (ModelState.IsValid) { db.Entry(profitCenter).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(profitCenter)); }
public ActionResult Create([Bind(Include = "ProfitCenterID,ProfitCenterDescription")] ProfitCenter profitCenter) { if (ModelState.IsValid) { db.ProfitCenters.Add(profitCenter); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(profitCenter)); }
// GET: ProfitCenters/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProfitCenter profitCenter = db.ProfitCenters.Find(id); if (profitCenter == null) { return(HttpNotFound()); } return(View(profitCenter)); }
protected override void ActivateView(string viewName, System.Collections.Generic.IDictionary <string, object> viewParameters) { try { IsNew = (bool)viewParameters["New"]; } catch (KeyNotFoundException) { } var planningGroup = (PlanningGroup)viewParameters["PlanningGroup"]; if (planningGroup != null) { PlanningGroup = planningGroup; } ReportControl = new ReportControlViewModel(); if (planningGroup != null) { ReportControl.CurrentPlanningGroupId = planningGroup.PlanningGroupId; } ReportControl.LoadReportsForView((int)ReportViews.PlanningGroup, ReportService); RaisePropertyChanged(() => ReportControl); try { var profitCenterOrganization = (Organization)viewParameters["Organization"]; if (profitCenterOrganization != null) { CurrentProfitCenter = new ProfitCenter() { Name = profitCenterOrganization.Name, ProfitCenterNumber = profitCenterOrganization.ExternalId }; } } catch (KeyNotFoundException) { } }