public GalleryAddOrUpdateResponseDto AddOrUpdate(GalleryAddOrUpdateRequestDto request) { var gallery = uow.Galleries.GetAll() .Where(x => x.Name == request.Name && x.IsDeleted == false) .FirstOrDefault(); if (gallery == null) uow.Galleries.Add(gallery = new Gallery()); gallery.Name = request.Name; uow.SaveChanges(); return new GalleryAddOrUpdateResponseDto(gallery); }
public GalleryAddOrUpdateResponseDto(Gallery model) { this.Id = model.Id; this.Name = model.Name; }
public GalleryDto(Gallery model) { this.Id = model.Id; this.Name = model.Name; this.GalleryPhotosCount = model.GalleryPhotos.Count; }