Esempio n. 1
0
        public ActionResult EditObjective(int id = 0)
        {
            PlanObjective model = db.PlanObjectives.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            int?companyID = Helper.GetCompanyID(db);

            ViewBag.responsible = new SelectList(db.Positions.Where(d => d.companyID == companyID), "ID", "name", model.responsible);

            return(View(model));
        }
Esempio n. 2
0
        public ActionResult EditObjective(PlanObjective model)
        {
            if (ModelState.IsValid)
            {
                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Edit", new { id = model.planID }));
            }
            int?companyID = Helper.GetCompanyID(db);

            ViewBag.responsible = new SelectList(db.Positions.Where(d => d.companyID == companyID), "ID", "name", model.responsible);

            return(View(model));
        }
Esempio n. 3
0
        public ActionResult AddObjective(PlanObjective model)
        {
            if (ModelState.IsValid)
            {
                model.createUser = WebSecurity.CurrentUserId;
                db.PlanObjectives.Add(model);
                db.SaveChanges();

                return(View("EditObjective", new { id = model.ID }));
            }
            int?companyID = Helper.GetCompanyID(db);

            ViewBag.planID      = model.planID;
            ViewBag.responsible = new SelectList(db.Positions.Where(d => d.companyID == companyID), "ID", "name");

            return(View(model));
        }