Exemple #1
0
 //common lib
 public bool Insert(goal_type entity)
 {
     try
     {
         db.goal_type.Add(entity);
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #2
0
 public bool Update(goal_type entity)
 {
     try
     {
         var info = db.goal_type.Find(entity.id);
         info.name = entity.name;
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #3
0
        public ActionResult Edit(goal_type type)
        {
            if (ModelState.IsValid)
            {
                var dao = new goal_type_dao();

                var result = dao.Update(type);
                if (result)
                {
                    SetAlert(StaticResources.Resources.Pub_UpdateSucess, "success");
                    return(RedirectToAction("Index", "GoalType"));
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.UpdateGoalTypeFailed);
                }
            }
            return(View());
        }