예제 #1
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)));
            }
        }
예제 #2
0
        public IActionResult Delete(Guid id)
        {
            OperationResultVo result = userContentAppService.Remove(CurrentUserId, id);

            if (result.Success)
            {
                result.Message = SharedLocalizer["Content deleted successfully!"];
            }
            else
            {
                result.Message = SharedLocalizer["Oops! The content was not deleted!"];
            }

            return(Json(result));
        }