Example #1
0
        public IActionResult ConfirmedDelete(int resumepageId)
        {
            var entity = _resumepageService.GetByIdWithObjects(resumepageId);

            if (entity != null)
            {
                if (entity.Skills.Count != 0)
                {
                    foreach (var item in entity.Skills)
                    {
                        var model = new Skills()
                        {
                            isApproved   = item.isApproved,
                            ResumepageId = null,
                            SkillPercent = item.SkillPercent,
                            SkillsId     = item.SkillsId,
                            SkillTitle   = item.SkillTitle
                        };
                        _skillsService.Update(model);
                    }
                }
                if (entity.Educations.Count != 0)
                {
                    foreach (var item in entity.Educations)
                    {
                        var model = new Education()
                        {
                            isApproved    = item.isApproved,
                            ResumepageId  = null,
                            Date          = item.Date,
                            Description   = item.Description,
                            EducationId   = item.EducationId,
                            EducationType = item.EducationType,
                            Title         = item.Title,
                        };
                        _educationService.Update(model);
                    }
                }
                if (entity.Experiences.Count != 0)
                {
                    foreach (var item in entity.Experiences)
                    {
                        var model = new Experience()
                        {
                            isApproved   = item.isApproved,
                            ResumepageId = null,
                            Date         = item.Date,
                            Description  = item.Description,
                            ExperienceId = item.ExperienceId,
                            CompanyName  = item.CompanyName,
                            Title        = item.Title,
                        };
                        _experienceService.Update(model);
                    }
                }
                _resumepageService.Delete(entity);
            }
            TempData.Put("message", new ResultMessage()
            {
                Title   = "Bildirim",
                Message = "Hakkımda sayfası ve bağlantılar başarılı bir şekilde silindi.",
                Css     = "success"
            });
            return(RedirectToAction("Index"));
        }