Exemplo n.º 1
0
 public ActionResult AddState(watershed_state data)
 {
     if (DAL.VillageDataDal.AddState(data) == true)
     {
         ViewData.Add("AddState", "success");
     }
     else
     {
         ViewData.Add("AddState", "fail");
     }
     return View();
 }
Exemplo n.º 2
0
        public ActionResult AddState(watershed_state state)
        {
            //WaterShed.WaterShedservice.Service1Client service = new WaterShed.WaterShedservice.Service1Client();
            String statelist = StateList.GetStateList();

            try
            {
                return(Json(new
                {
                    msg = "success ", list = statelist
                }));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public static bool AddState(watershed_state state)
        {
            watershedEntities db = new watershedEntities();

            if (null == getStatesByName(state.sname))
            {
                try
                {
                    db.watershed_state.Add(state);
                    db.SaveChanges();
                }catch (DbEntityValidationException ex)
                {
                    return(false);
                }
                return(true);
            }
            return(false);
        }