/// <summary>
 /// Method ToBllCategoryPhoto convert DalCategoryPhoto to CategoryPhotoEntity.
 /// </summary>
 /// <param name="ctgrPhoto">CategoryPhotoEntity that need convert.</param>
 /// <returns>CategoryPhotoEntity entity.</returns>
 public static CategoryPhotoEntity ToBllCategoryPhoto(this DalCategoryPhoto ctgrPhoto)
 {
     return(new CategoryPhotoEntity()
     {
         CategoryId = ctgrPhoto.Id,
         Name = ctgrPhoto.Name
     });
 }
        /// <summary>
        /// Method Delete dalPhoto.
        /// </summary>
        /// <param name="dalCategory">Entity that need delete.</param>
        public void Delete(DalCategoryPhoto dalCategory)
        {
            var categoryPhoto = new CategoryPhoto()
            {
                Name = dalCategory.Name
            };

            context.Set <CategoryPhoto>().Remove(categoryPhoto);
        }
        /// <summary>
        /// Method Create create category entity.
        /// </summary>
        /// <param name="dalCategory">New category entity for create.</param>
        public void Create(DalCategoryPhoto dalCategory)
        {
            var categoryPhoto = new CategoryPhoto()
            {
                Name = dalCategory.Name
            };

            context.Set <CategoryPhoto>().Add(categoryPhoto);
        }
        /// <summary>
        /// Method Update update exists category.
        /// </summary>
        /// <param name="dalCategory">DalCategoryPhoto that need update.</param>
        public void Update(DalCategoryPhoto dalCategory)
        {
            var           actualCategory  = GetById(dalCategory.Id);
            CategoryPhoto updatedCategory = new CategoryPhoto()
            {
                Id   = actualCategory.Id,
                Name = actualCategory.Name
            };

            context.Set <CategoryPhoto>().Attach(updatedCategory);
            var category = context.Entry(updatedCategory);

            category.Property(ctg => ctg.Name).IsModified = true;
            context.SaveChanges();
        }