示例#1
0
        public ActionResult ManageCityTable()
        {
            ManageLocation objManageLocation = new ManageLocation();

            ViewBag.PageNumber = (Request.QueryString["grid-page"] == null) ? "1" : Request.QueryString["grid-page"];

            using (var con = new SqlConnection(_connectionString))
            {
                var result = con.Query <ManageLocation>("GetLocationDetails", new { }, commandType: CommandType.StoredProcedure).ToList();
                // objManageLocation.ManageLocationList
                return(View(result));
            }
            //return View(objManageLocation);
        }
示例#2
0
        public ActionResult AddCityLocation()
        {
            ManageLocation ml = new ManageLocation();

            ml._CountryList = new SelectList(Enumerable.Empty <SelectListItem>());
            ml._StateList   = new SelectList(Enumerable.Empty <SelectListItem>());

            using (var con = new SqlConnection(_connectionString))
            {
                ml._CountryList = new SelectList(dropdown.BindCountry(), "Value", "Text");

                return(View(ml));
            }
        }
示例#3
0
        public ActionResult AddCityLocation(ManageLocation model)
        {
            try
            {
                using (var con = new SqlConnection(_connectionString))
                {
                    var result = con.Query <int>("Add_Edit_Delete_Location",
                                                 new
                    {
                        LocationId = "",
                        model.LocationName,
                        model.StateId,
                        model.CountryId,
                        model.DistrictName,
                        model.PinCode,
                        model.IsActive,
                        model.Comments,
                        User   = CurrentUser.UserId,
                        Action = "add"
                    }, commandType: CommandType.StoredProcedure).FirstOrDefault();
                    var response = new ResponseModel();
                    if (result == 1)
                    {
                        response.IsSuccess   = true;
                        response.Response    = "Successfully Added";
                        TempData["response"] = response;
                    }
                    else
                    {
                        response.IsSuccess   = true;
                        response.Response    = "Location Name Already Exist";
                        TempData["response"] = response;
                    }
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(RedirectToAction("ManageCityLocation"));
        }
示例#4
0
 private ManageLocationBo BuiltManageLocationBo(ManageLocation location)
 {
     return((ManageLocationBo) new ManageLocationBo().InjectFrom(location));
 }