Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, EmploymentApplicationViewModel model)
        {
            try
            {
                var employmentApplicationViewModel = await _iEmploymentApplicationManager.GetEmploymentApplicationAsync(id);

                if (id == model.Id)
                {
                    if (ModelState.IsValid)
                    {
                        _result = await _iEmploymentApplicationManager.UpdateEmploymentApplicationAsync(model);

                        return(RedirectToAction(nameof(Index)));
                    }
                    return(View(model));
                }
                else
                {
                    return(ErrorView(ExceptionHelper.ExceptionErrorMessageForNullObject()));
                }
            }
            catch (Exception ex)
            {
                return(ErrorView(ex));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(string id, [Bind("FirstName,LastName,DisplayName,EmailAddress,PhoneNumber,City,State,Country,ZipCode,IsArchived,IsDeleted,Id")] EmploymentApplicationViewModel model)
        {
            try
            {
                var employmentApplicationViewModel = await _iEmploymentApplicationManager.GetEmploymentApplicationAsync(id);

                if (id == model.Id)
                {
                    if (ModelState.IsValid)
                    {
                        _result = await _iEmploymentApplicationManager.UpdateEmploymentApplicationAsync(model);

                        return(RedirectToAction(nameof(Index)));
                    }
                    return(View(model));
                }
                else
                {
                    return(ErrorView(ExceptionHelper.ExceptionErrorMessageForNullObject()));
                }
            }
            catch (Exception ex)
            {
                return(ErrorView(ex));
            }
        }
Ejemplo n.º 3
0
 public IActionResult Create()
 {
     try
     {
         var employmentApplicationViewModel = new EmploymentApplicationViewModel();
         return(View(employmentApplicationViewModel));
     }
     catch (Exception ex)
     {
         return(ErrorView(ex));
     }
 }
Ejemplo n.º 4
0
 public IActionResult Application()
 {
     try
     {
         EmploymentApplicationViewModel model = new EmploymentApplicationViewModel();
         return(View(model));
     }
     catch (Exception ex)
     {
         _logger.LogError(LoggerMessageHelper.FormateMessageForException(ex, "Application"));
         return(ErrorView(ex));
     }
 }
        public async Task <Result> UpdateEmploymentApplicationAsync(EmploymentApplicationViewModel model)
        {
            var data = _iMapper.Map <EmploymentApplicationViewModel, EmploymentApplication>(model);

            var saveChange = await _iEmploymentApplicationRepository.UpdateEmploymentApplicationAsync(data);

            if (saveChange > 0)
            {
                return(Result.Ok(MessageHelper.Update));
            }
            else
            {
                return(Result.Fail(MessageHelper.UpdateFail));
            }
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Create(EmploymentApplicationViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _result = await _iEmploymentApplicationManager.InsertEmploymentApplicationAsync(model);

                    return(RedirectToAction(nameof(Index)));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                return(ErrorView(ex));
            }
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("FirstName,LastName,DisplayName,EmailAddress,PhoneNumber,City,State,Country,ZipCode,IsArchived,IsDeleted,Id")] EmploymentApplicationViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _result = await _iEmploymentApplicationManager.InsertEmploymentApplicationAsync(model);

                    return(RedirectToAction(nameof(Index)));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                return(ErrorView(ex));
            }
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Application(EmploymentApplicationViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _result = await _iEmploymentApplicationManager.InsertEmploymentApplicationAsync(model);

                    //return RedirectToAction("Index", "Home");
                    return(View("~/Views/Employment/ApplicationSuccess.cshtml"));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                _logger.LogError(LoggerMessageHelper.FormateMessageForException(ex, "Application"));
                return(ErrorView(ex));
            }
        }
        public async Task <Result> UpdateEmploymentApplicationAsync(EmploymentApplicationViewModel viewModel)
        {
            try
            {
                var model      = _iMapper.Map <EmploymentApplicationViewModel, EmploymentApplication>(viewModel);
                var saveChange = await _employmentApplicationRepository.UpdateEmploymentApplicationAsync(model);

                if (saveChange)
                {
                    return(Result.Ok(MessageHelper.Update));
                }
                else
                {
                    return(Result.Fail(MessageHelper.UpdateFail));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <Result> InsertEmploymentApplicationAsync(EmploymentApplicationViewModel model)
        {
            try
            {
                var data = _iMapper.Map <EmploymentApplicationViewModel, EmploymentApplication>(model);

                var saveChange = await _iEmploymentApplicationRepository.InsertEmploymentApplicationAsync(data);

                if (saveChange > 0)
                {
                    return(Result.Ok(MessageHelper.Save));
                }
                else
                {
                    return(Result.Fail(MessageHelper.SaveFail));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public async Task <int> InsertOrUpdatetEmploymentApplicationAsync(EmploymentApplicationViewModel model)
        {
            var data = _iMapper.Map <EmploymentApplicationViewModel, EmploymentApplication>(model);

            return(await _iEmploymentApplicationRepository.InsertOrUpdatetEmploymentApplicationAsync(data));
        }