コード例 #1
0
        public async Task <IActionResult> Create(StateRegistrationCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new StateRegistration
                {
                    id = model.id
                    ,
                    countryid = model.countryid
                    ,
                    StateName = model.StateName

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.state.Add(objcategory);
                bool res = _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                ViewBag.Allcountry = _unitofWork.country.GetAll().Where(x => x.isdeleted == false).Select(x => new SelectListItem()
                {
                    Text  = x.countryname,
                    Value = x.id.ToString()
                });
                return(View(model));
            }
        }
コード例 #2
0
        /// <summary>
        /// Создать государственную регистрацию
        /// </summary>
        /// <returns>Идентификатор государственной регистрации</returns>
        public StateRegistration Create()
        {
            var createdStateRegistration = new StateRegistration();

            var newStateRegistration = _domainContext.Set <StateRegistration>().Add(createdStateRegistration);

            return(newStateRegistration.Entity);
        }
コード例 #3
0
 public static StateRegistrationResult ConvertToResult(StateRegistration stateRegistration)
 {
     return(new StateRegistrationResult
     {
         Id = stateRegistration.Id,
         Inn = stateRegistration.Inn ?? string.Empty,
         Ogrnip = stateRegistration.Ogrnip ?? string.Empty
     });
 }
コード例 #4
0
        public static StateRegistrationResult ConvertToResult(StateRegistration stateRegistration)
        {
            Contract.Argument.IsNotNull(stateRegistration, nameof(stateRegistration));

            return(new StateRegistrationResult
            {
                Id = stateRegistration.Id,
                Inn = stateRegistration.Inn,
                Ogrnip = stateRegistration.Ogrnip
            });
        }
        public async Task <IActionResult> Create(StateCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcountry = new StateRegistration
                {
                    id        = model.id,
                    countryid = model.countryid,
                    StateName = model.StateName,
                    isdeleted = false,
                    isactive  = false
                };

                await _StateRegistrationService.CreateAsync(objcountry);

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(model));
            }
        }
コード例 #6
0
 public async Task UpdateAsync(StateRegistration obj)
 {
     _context.StateRegistration.Update(obj);
     await _context.SaveChangesAsync();
 }
コード例 #7
0
        public async Task CreateAsync(StateRegistration obj)
        {
            await _context.StateRegistration.AddAsync(obj);

            await _context.SaveChangesAsync();
        }