public ActionResult Edit(int id)
        {
            NationalitySinglePageViewModel model = new NationalitySinglePageViewModel();

            model.NationalityViewModel = _nationalityService.GetNationalityById(id).ConvertToViewModel();
            return(View(model));
        }
Beispiel #2
0
        public ActionResult Create()
        {
            NationalitySinglePageViewModel model = new NationalitySinglePageViewModel();

            model.NationalityViewModel = new NationalityViewModel();
            model.Success = true;
            return(View(model));
        }
        public ActionResult Edit(NationalitySinglePageViewModel model)
        {
            if (ModelState.IsValid)
            {
                _nationalityService.UpdateNationality(model.NationalityViewModel.ConvertToModel());
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Beispiel #4
0
        public ActionResult Edit(NationalitySinglePageViewModel model)
        {
            UpdateNationalityRequest  request  = model.NationalityViewModel.ConvertToUpdateNationalityRequest();
            UpdateNationalityResponse response = _nationalityService.UpdateNatonality(request);

            if (response.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                model.Success = false;
                model.Message = response.Message;
                return(View(model));
            }
        }
Beispiel #5
0
        public ActionResult Edit(int id)
        {
            NationalitySinglePageViewModel model    = new NationalitySinglePageViewModel();
            FindAllNationalitiesResponse   response = _nationalityService.FindAllNationalities();

            if (response.Success)
            {
                model.NationalityViewModel = response.Nationalities.Where(x => x.NationalityId == id).First().ConvertToNationalityViewModel();
                model.Success = true;
            }
            else
            {
                model.Success = false;
                model.Message = response.Message;
            }
            return(View(model));
        }