public void AddPictureForTheKitten(string kittenName, Pictures picture)
        {
            var kitten = _dbContext.Pets.FirstOrDefault(i => i.Name == kittenName);

            if(kitten != null)
                kitten.Pictures.Add(picture);
        }
示例#2
0
        public int RemovePicture(Pictures picture)
        {
            if (picture != null)
            {
                _picturesRepository.Delete(picture.ID);
                _picturesRepository.Save();

                var smallKittenPath = _picturesLinksConstructor.GetSmallKittenImageFileName(picture.Image);

                RemoveFile(Server.MapPath(picture.Image));
                RemoveFile(Server.MapPath(smallKittenPath));
            }

            return picture.ID;
        }
 public void Update(Pictures pet)
 {
     throw new System.NotImplementedException();
 }
 public void Insert(Pictures picture)
 {
     _dbContext.Pictures.Add(picture);
 }