Example #1
0
        public async Task <IActionResult> OnPostSearch([FromBody] SearchPositionQuery command)
        {
            try
            {
                List <SearchedPosition> result = new List <SearchedPosition>();
                result = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = result },
                    Status = UIStatus.Success,
                    Text = string.Empty,
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Example #2
0
        public async Task <IActionResult> OnPostPositions([FromBody] SearchPositionQuery command)
        {
            try
            {
                List <SearchedPosition> presult = new List <SearchedPosition>();
                presult = await Mediator.Send(command);

                List <object> result = new List <object>();
                List <SearchedOrgPosition> PositionType = new List <SearchedOrgPosition>();
                PositionType = await Mediator.Send(new SearchOrgPositionQuery()
                {
                    Id = presult.FirstOrDefault().PositionTypeId, Children = true
                });

                foreach (SearchedOrgPosition po in PositionType)
                {
                    result.Add(new { Text = po.PositionTypeText + " | " + po.RankText, ID = po.Id.ToString() });
                }


                return(new JsonResult(new UIResult()
                {
                    Data = new { list = result },
                    Status = UIStatus.Success,
                    Text = string.Empty,
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new UIResult()
                {
                    Data = null,
                    Status = UIStatus.Failure,
                    Text = CustomMessages.InternalSystemException,
                    Description = ex.Message
                }));
            }
        }