public ActionResult SaveGoal(FormCollection collection) { var existingRecord = Boolean.Parse(collection["goal-existing-record"].ToString()); var id = Guid.Parse(collection["goal-id"].ToString()); var name = collection["goal-name"].ToString(); var type = collection["goal-type"].ToString(); var team = collection["goal-team"].ToString(); var frequency = collection["goal-frequency"].ToString(); PlanPerformance.Business.Entities.Goal goal; if (existingRecord == false) { goal = new PlanPerformance.Business.Entities.Goal(); } else { goal = new PlanPerformance.Business.Entities.Goal(id); } goal.Name = name; goal.Type = type; goal.Team = team; goal.Frequency = frequency; var userDih = DataIntegrationHub.Business.Entities.User.AllUsers().Find(x => x.EmailAddress.ToUpper() == User.Identity.Name.ToUpper()); goal.SaveRecordToDatabase(userDih.UserId); return(View()); }
public ActionResult Goal() { var id = Request.QueryString["id"]; var goal = new PlanPerformance.Business.Entities.Goal(); if (String.IsNullOrWhiteSpace(id)) { ViewBag.Title = "New Goal"; } else { goal = new PlanPerformance.Business.Entities.Goal(Guid.Parse(id)); ViewBag.Title = goal.Name; } return(View(goal)); }
public ActionResult DeleteGoal(FormCollection collection) { var id = collection["goal-id"]; var goal = new PlanPerformance.Business.Entities.Goal(); if (String.IsNullOrWhiteSpace(id)) { return(View()); } else { goal = new PlanPerformance.Business.Entities.Goal(Guid.Parse(id)); var userDih = DataIntegrationHub.Business.Entities.User.AllUsers().Find(x => x.EmailAddress.ToUpper() == User.Identity.Name.ToUpper()); goal.DeleteRecordFromDatabase(userDih.UserId); } return(View()); }