示例#1
0
        private void GenerateFeedPost(JobPositionViewModel vm)
        {
            if (vm != null && vm.Status == JobPositionStatus.OpenForApplication)
            {
                string json = JsonConvert.SerializeObject(vm);

                UserContentViewModel newContent = new UserContentViewModel
                {
                    UserId          = CurrentUserId,
                    UserContentType = UserContentType.JobPosition,
                    Content         = json,
                    Language        = vm.Language
                };

                OperationResultListVo <Application.ViewModels.Search.UserContentSearchViewModel> searchContentResult = userContentAppService.Search(CurrentUserId, vm.Id.ToString());

                if (searchContentResult.Success && searchContentResult.Value.Any())
                {
                    Application.ViewModels.Search.UserContentSearchViewModel existing = searchContentResult.Value.FirstOrDefault();

                    if (existing != null)
                    {
                        newContent.Id = existing.ContentId;
                    }
                }

                userContentAppService.Save(CurrentUserId, newContent);
            }
        }
示例#2
0
        public IActionResult DeleteJobPosition(Guid jobPositionId)
        {
            try
            {
                OperationResultVo serviceResult = jobPositionAppService.Remove(CurrentUserId, jobPositionId);

                OperationResultListVo <Application.ViewModels.Search.UserContentSearchViewModel> searchContentResult = userContentAppService.Search(CurrentUserId, jobPositionId.ToString());

                if (searchContentResult.Success && searchContentResult.Value.Any())
                {
                    Application.ViewModels.Search.UserContentSearchViewModel existing = searchContentResult.Value.FirstOrDefault();

                    if (existing != null)
                    {
                        userContentAppService.Remove(CurrentUserId, existing.ContentId);
                    }
                }

                string url = Url.Action("Index", "JobPosition", new { area = "Work" });

                return(Json(new OperationResultRedirectVo(url, serviceResult.Message)));
            }
            catch (Exception ex)
            {
                return(Json(new OperationResultVo(ex.Message)));
            }
        }