Пример #1
0
        public ActionResult Create(goal goal)
        {
            try
            {
                if (goal.Comment == null)
                {
                    goal.Comment = "";
                }
                if (goal.Description == null)
                {
                    goal.Description = "";
                }

                if (ModelState.IsValid)
                {
                    db.goals.Add(goal);
                    db.SaveChanges();
                    TempData["Message2"] = "Goal record added successfully.";
                    GetData(goal.ministryID);
                    GoalRepository.AddRecord(goal);
                    // return RedirectToAction("Create", new {ministryID =goal.ministryID});
                    return(RedirectToAction("Create"));
                }
            }
            catch (Exception ex)
            {
                TempData["Message2"] = "Error adding goal";
            }
            GetData(goal.ministryID);
            return(PartialView(goal));
        }