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)); } }
/// <summary> /// Создать государственную регистрацию /// </summary> /// <returns>Идентификатор государственной регистрации</returns> public StateRegistration Create() { var createdStateRegistration = new StateRegistration(); var newStateRegistration = _domainContext.Set <StateRegistration>().Add(createdStateRegistration); return(newStateRegistration.Entity); }
public static StateRegistrationResult ConvertToResult(StateRegistration stateRegistration) { return(new StateRegistrationResult { Id = stateRegistration.Id, Inn = stateRegistration.Inn ?? string.Empty, Ogrnip = stateRegistration.Ogrnip ?? string.Empty }); }
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)); } }
public async Task UpdateAsync(StateRegistration obj) { _context.StateRegistration.Update(obj); await _context.SaveChangesAsync(); }
public async Task CreateAsync(StateRegistration obj) { await _context.StateRegistration.AddAsync(obj); await _context.SaveChangesAsync(); }