Example #1
0
 public PeriodicalDto(Periodical periodical)
 {
     Id = periodical.Id;
     Name = periodical.Name;
     Description = periodical.Description;
     Themes = periodical.Themes.ToDto().ToList();
 }
 public int Create(Periodical periodical)
 {
     if (periodical != null && _unitOfWork.PeriodicalRepository.GetById(periodical.Id) == null)
     {
         _unitOfWork.PeriodicalRepository.Add(periodical);
         _unitOfWork.Save();
     }
     return periodical.Id;
 }
 public bool Edit(Periodical editedPeriodical)
 {
     if (editedPeriodical != null && _unitOfWork.PeriodicalRepository.GetById(editedPeriodical.Id) == null)
     {
         _unitOfWork.PeriodicalRepository.Update(editedPeriodical);
         _unitOfWork.Save();
         return true;
     }
     return false;
 }
 public bool Delete(Periodical deletedPeriodical)
 {
     if (deletedPeriodical != null && _unitOfWork.PeriodicalRepository.GetById(deletedPeriodical.Id) == null)
     {
         _unitOfWork.PeriodicalRepository.Delete(deletedPeriodical);
         _unitOfWork.Save();
         return true;
     }
     return false;
 }