public void Insert(PromoPicture pictureDetails)
 {
     this._repository.Insert(pictureDetails);
     _eventPublisher.EntityInserted<PromoPicture>(pictureDetails);
 }
 public void Delete(PromoPicture pictureDetails)
 {
     this._repository.Delete(pictureDetails);
     _eventPublisher.EntityDeleted<PromoPicture>(pictureDetails);
 }
        public ActionResult PictureAdd(int pictureId, bool defaultForType, string promoRef, string promoType)
        {
            if ((pictureId == 0)
                || (!defaultForType && string.IsNullOrEmpty(promoRef))
                || (defaultForType && string.IsNullOrEmpty(promoType)))
            {
                ModelState.AddModelError(string.Empty, _localizationService.GetResource("Plugins.Widgets.QixolPromo.PromoPicture.ValidationMsg.Add"));
                return Json(new DataSourceResult { Errors = ModelState.SerializeErrors() });
            }                

            var newPromoPicture = new PromoPicture()
            {
                PictureId = pictureId,
                IsDefaultForType = defaultForType,
                PromoReference = defaultForType ? string.Empty : promoRef,
                PromoTypeName = defaultForType ? promoType : string.Empty
            };

            _promoPictureService.Insert(newPromoPicture);

            return Json(new { Result = true }, JsonRequestBehavior.AllowGet);
        }