/// <summary> /// Remove SectionParagraph. /// </summary> /// <param name="request">The SectionParagraph Request Pivot to remove.</param> public void DeleteSectionParagraph(SectionParagraphRequestPivot request) { if (request?.SectionParagraphPivot == null) { throw new ArgumentNullException(nameof(request)); } SectionParagraph sectionParagraph = _unitOfWork.SectionParagraphRepository.GetById(request.SectionParagraphPivot.ParagraphId); _unitOfWork.SectionParagraphRepository.Delete(sectionParagraph); _unitOfWork.Save(); }
/// <summary> /// From SectionParagraph To SectionParagraph Pivot. /// </summary> /// <param name="sectionParagraph">sectionParagraph TO ASSEMBLE</param> /// <returns>SectionParagraphPivot result.</returns> public static SectionParagraphPivot ToPivot(this SectionParagraph sectionParagraph) { if (sectionParagraph == null) { return(null); } return(new SectionParagraphPivot { Section = sectionParagraph.Section?.ToPivot(), ParagraphId = sectionParagraph.ParagraphId, SectionId = sectionParagraph.SectionId }); }
/// <summary> /// Create new SectionParagraph. /// </summary> /// <param name="request">The SectionParagraph Request Pivot to add.</param> /// <returns>SectionParagraph Response Pivot added.</returns> public SectionParagraphResponsePivot CreateSectionParagraph(SectionParagraphRequestPivot request) { if (request?.SectionParagraphPivot == null) { throw new ArgumentNullException(nameof(request)); } SectionParagraph sectionParagraph = request.SectionParagraphPivot.ToEntity(); _unitOfWork.SectionParagraphRepository.Insert(sectionParagraph); _unitOfWork.Save(); return(new SectionParagraphResponsePivot { SectionParagraphPivot = sectionParagraph.ToPivot() }); }