public async Task <IActionResult> Create(CountryRegistrationCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new CountryRegistration
                {
                    id = model.id
                    ,
                    countrycode = model.countrycode
                    ,
                    countryname = model.countryname

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.country.Add(objcategory);
                bool res = _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
        public async Task <IActionResult> Create(CountryCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcountry = new CountryRegistration
                {
                    id          = model.id,
                    countryname = model.countryname,
                    countrycode = "",
                    isdeleted   = false,
                    isactive    = false
                };

                await _CountryRegistrationservices.CreateAsync(objcountry);

                TempData["success"] = "Record Saved successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
Esempio n. 3
0
 public async Task UpdateAsync(CountryRegistration obj)
 {
     _context.CountryRegistration.Update(obj);
     await _context.SaveChangesAsync();
 }
Esempio n. 4
0
        public async Task CreateAsync(CountryRegistration obj)
        {
            await _context.CountryRegistration.AddAsync(obj);

            await _context.SaveChangesAsync();
        }