Пример #1
0
        public CMSResult Update(PDFCategory oldPDFCategory)
        {
            CMSResult result   = new CMSResult();
            var       isExists = _repository.Project <PDFCategory, bool>(pdfcrs => (from b in pdfcrs where b.PDFCategoryId != oldPDFCategory.PDFCategoryId && b.Name == oldPDFCategory.Name select b).Any());

            if (isExists)
            {
                result.Results.Add(new Result {
                    IsSuccessful = false, Message = string.Format("Board '{0}' already exists!", oldPDFCategory.Name)
                });
            }
            else
            {
                var pdfcs = _repository.Load <PDFCategory>(b => b.PDFCategoryId == oldPDFCategory.PDFCategoryId);
                pdfcs.Name = oldPDFCategory.Name;
                _repository.Update(pdfcs);
                result.Results.Add(new Result {
                    IsSuccessful = true, Message = string.Format("PDF Category '{0}' updated successfully!", oldPDFCategory.Name)
                });
            }
            return(result);
        }
Пример #2
0
        public CMSResult Save(PDFCategory newPDFCategory)
        {
            CMSResult result   = new CMSResult();
            var       isExists = _repository.Project <PDFCategory, bool>(pdfcategories => (
                                                                             from b in pdfcategories
                                                                             where b.Name == newPDFCategory.Name
                                                                             select b
                                                                             ).Any());

            if (isExists)
            {
                result.Results.Add(new Result {
                    IsSuccessful = false, Message = string.Format("PDF Category '{0}' already exists!", newPDFCategory.Name)
                });
            }
            else
            {
                _repository.Add(newPDFCategory);
                result.Results.Add(new Result {
                    IsSuccessful = true, Message = string.Format("PDF Category '{0}' added successfully!", newPDFCategory.Name)
                });
            }
            return(result);
        }
Пример #3
0
 CMSResult IPDFCategoryService.Update(PDFCategory oldPDFCategory)
 {
     throw new NotImplementedException();
 }
Пример #4
0
 CMSResult IPDFCategoryService.Save(PDFCategory newPDFCategory)
 {
     throw new NotImplementedException();
 }