Example #1
0
        public async Task <IActionResult> Edit(countryIndexViewModel model)
        {
            if (ModelState.IsValid)
            {
                var storeobj = _unitofWork.country.Get(model.id);
                if (storeobj == null)
                {
                    TempData["error"] = "Record Not Found";
                    return(NotFound());
                }
                storeobj.id          = model.id;
                storeobj.Name        = model.Name;
                storeobj.countrycode = model.countrycode;


                _unitofWork.country.Update(storeobj);
                _unitofWork.Save();
                TempData["success"] = "Record Update successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
Example #2
0
        public async Task <IActionResult> Create(countryIndexViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new country
                {
                    id = model.id
                    ,
                    Name          = model.Name
                    , countrycode = model.countrycode

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.country.Add(objcategory);
                _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
Example #3
0
        public IActionResult Edit(int id)
        {
            var objcategory = _unitofWork.country.Get(id);

            if (objcategory == null)
            {
                return(NotFound());
            }
            var model = new countryIndexViewModel()
            {
                id          = objcategory.id,
                Name        = objcategory.Name,
                countrycode = objcategory.countrycode,
                isactive    = objcategory.isactive,
                isdeleted   = objcategory.isdeleted
            };

            return(View(model));
        }
Example #4
0
        public IActionResult Create()
        {
            var model = new countryIndexViewModel();

            return(View(model));
        }