public JsonResult Add(Master_Country c)
        {
            //if (!ModelState.IsValid)
            //{
            //return Json(new { success = false, issue = c, errors = ModelState.Values.Where(i => i.Errors.Count > 0) });
            //}
            var redirectUrl = new UrlHelper(Request.RequestContext).Action("Index", "Country");

            return(Json(db.Add(c), JsonRequestBehavior.AllowGet));
        }
Example #2
0
 public EmployementController(IEmployementService IEmployementService, ICityService ICityService, IStateService IStateService, ICountryService ICountryService, IUserService IUserService, IEmploymentCountService IEmploymentCountService)
 {
     this._IEmployementService = IEmployementService;
     _employement       = new EmploymentDetail();
     this._ICityService = ICityService;
     _city = new Master_City();
     this._IStateService = IStateService;
     _state = new Master_State();
     this._ICountryService = ICountryService;
     _country                      = new Master_Country();
     this._IUserService            = IUserService;
     this._IEmploymentCountService = IEmploymentCountService;
 }
        //Country Add
        public int Add(Master_Country c)
        {
            int i;

            using (SqlConnection con = new SqlConnection(cs))
            {
                con.Open();
                string     q   = "insert into Master_Country(CountryName,CountryInitial) values(@CountryName,@CountryInitial)";
                SqlCommand com = new SqlCommand(q, con);
                com.Parameters.AddWithValue("@CountryName", c.CountryName);
                com.Parameters.AddWithValue("@CountryInitial", c.CountryInitial);
                i = com.ExecuteNonQuery();
            }
            return(i);
        }
        //Method for Updating Country
        public int Update(Master_Country c)
        {
            int i;

            using (SqlConnection con = new SqlConnection(cs))
            {
                con.Open();
                string     q   = "update Master_Country set CountryName=@CountryName,CountryInitial=@CountryInitial where CountryCode=@CountryCode";
                SqlCommand com = new SqlCommand(q, con);
                com.Parameters.AddWithValue("@CountryCode", c.CountryCode);
                com.Parameters.AddWithValue("@CountryName", c.CountryName);
                com.Parameters.AddWithValue("@CountryInitial", c.CountryInitial);

                i = com.ExecuteNonQuery();
            }
            return(i);
        }
 public JsonResult update(Master_Country c)
 {
     return(Json(db.Update(c), JsonRequestBehavior.AllowGet));
 }
Example #6
0
 public bool Update(Master_Country obj, string[] param, string spName)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public IEnumerable <Master_Country> GetAll(Master_Country obj, string[] param, string spName)
 {
     return(_ICountryRepository.GetAll(obj, param, spName));
 }