Пример #1
0
        public async Task <Applicant> AddApplicant(AddApplicant addApplicant)
        {
            try
            {
                bool isValidCountry = await integrationService.IsCountryExist(addApplicant.CountryOfOrigin);

                if (isValidCountry)
                {
                    _Logger.LogInformation("Validation Success");
                    Applicant applicant = mapper.Map <Applicant>(addApplicant);
                    applicant.CreatedAt = DateTime.Now;
                    applicant.UpdatedAt = DateTime.Now;

                    _Logger.LogDebug($"The Object which gets inserted into the DB :- {JsonConvert.SerializeObject(applicant) }");
                    Applicant applicantfromDB = await repository.AddApplicant(applicant);

                    return(applicantfromDB);
                }
                else
                {
                    _Logger.LogInformation($" Invalid Country {addApplicant.CountryOfOrigin}");
                    throw new ArgumentException($"{addApplicant.CountryOfOrigin} is Invalid. Please check the CountryOfOrigin again", addApplicant.CountryOfOrigin.GetType().Name);
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError($"Error Occured while processing the Add Request. {ex.Message}");
                throw ex;
            }
        }
        public async Task <IActionResult> Post([FromBody] AddApplicant addApplicant)
        {
            _logger.LogInformation("this is test");
            var applicant = await applicantBiz.AddApplicant(addApplicant);

            var result = Json(applicant);

            result.StatusCode = (int)HttpStatusCode.Created;
            return(result);
        }
Пример #3
0
        private void btAddApplicant_Click(object sender, RoutedEventArgs e)
        {
            ApplicantViewModels applicantModel = new ApplicantViewModels();
            AddApplicant        aa             = new AddApplicant(applicantModel, positionsModel, agentsModel);

            aa.Title = "Добавление Соискателя";
            aa.Owner = this;
            var result = aa.ShowDialog();

            if (result == true)
            {
                applicantService.CreateApplicant(applicantModel);
                ResetCollection("ApplicantViewModel");
                ResetCollection("AgentsViewModel");
                int Index = applicantsModel.Count - 1;
                dGridApplicants.SelectedIndex = Index;
                aa.Close();
            }
        }
Пример #4
0
        public List <DTO.AddApplicant> SortApplicant(int CurrentIndex, String Mode)
        {
            for (int i = 0; i < ListApplicant.Count; i++)
            {
                ListApplicant[i].RUN_NO = (i + 1).ToString();
            }
            if (Mode.Equals("Up"))
            {
                //Get Current & Previous Data
                AddApplicant cur = ListApplicant[CurrentIndex];
                AddApplicant pre = ListApplicant[CurrentIndex - 1];

                int order = Convert.ToInt32(cur.RUN_NO);
                cur.RUN_NO = pre.RUN_NO;
                pre.RUN_NO = Convert.ToString(order);

                //Resort
                ListApplicant[CurrentIndex]     = pre;
                ListApplicant[CurrentIndex - 1] = cur;
            }
            else if (Mode.Equals("Down"))
            {
                //Get Current & Next Data
                AddApplicant cur  = ListApplicant[CurrentIndex];
                AddApplicant next = ListApplicant[CurrentIndex + 1];

                int order = Convert.ToInt32(cur.RUN_NO);
                cur.RUN_NO  = next.RUN_NO;
                next.RUN_NO = Convert.ToString(order);

                //Resort
                ListApplicant[CurrentIndex]     = next;
                ListApplicant[CurrentIndex + 1] = cur;
            }

            return(ListApplicant.OrderBy(idx => idx.RUN_NO).ToList());
        }