protected void UploadImageClick(object sender, EventArgs e)
        {
            if (SubscriptionImage.HasFile)
            {
                var file = SubscriptionImage.PostedFile;
                if (Request.Params["id"] != "0")
                {
                    string pathString     = Server.MapPath(string.Format("/HotelImage/s{0}/", _subscriptions.Id));
                    string localImageFile = string.Format("/HotelImage/s{0}/{1}", _subscriptions.Id, file.FileName);

                    if (!Directory.Exists(pathString))
                    {
                        Directory.CreateDirectory(pathString);
                    }
                    try
                    {
                        file.SaveAs(Server.MapPath(localImageFile));
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }

                    var image = new SubscriptionImages
                    {
                        SubscriptionId = _subscriptions.Id,
                        Url            = localImageFile,
                        IsActive       = true,
                        Order          = IsCoverCheckbox.Checked ? 1 : 2,
                        IsCover        = IsCoverCheckbox.Checked
                    };

                    _subscriptionRepository.AddImage(image);

                    _subscriptionRepository.ResetCache();

                    Response.Redirect(Request.Url.AbsoluteUri, true);
                }
            }
        }
        public int AddImage(SubscriptionImages entity)
        {
            using (var transaction = new TransactionScope())
            {
                if (entity.IsCover)
                {
                    var images = DayaxeDbContext.SubscriptionImages
                                 .Where(i => i.SubscriptionId == entity.SubscriptionId && i.IsActive)
                                 .ToList();

                    images.ForEach(image =>
                    {
                        image.IsCover = false;
                        image.Order   = 2;
                    });
                }
                DayaxeDbContext.SubscriptionImages.InsertOnSubmit(entity);

                Commit();
                transaction.Complete();
                return(entity.Id);
            }
        }