コード例 #1
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    IEnumerable <GenericControl> GenericControls =
                        from id in ids
                        select this._genericControlService.GetById(int.Parse(id));

                    this._genericControlService.BatchDelete(GenericControls);

                    //Delete localize
                    for (int i = 0; i < ids.Length; i++)
                    {
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetLocalizedPropertyByEntityId(int.Parse(ids[i]));
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("ServerGenericControl.Delete: ", exception.Message));
            }
            return(base.RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Delete(int[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    int[] numArray = ids;
                    for (int i = 0; i < (int)numArray.Length; i++)
                    {
                        int       num       = numArray[i];
                        SlideShow slideShow = this._slideShowService.Get((SlideShow x) => x.Id == num, false);
                        this._slideShowService.Delete(slideShow);

                        //Delete localize
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetLocalizedPropertyByEntityId(num);
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("SlideShow.Delete: ", exception.Message));
            }
            return(base.RedirectToAction("Index"));
        }
コード例 #3
0
ファイル: PostController.cs プロジェクト: cong1389/ThienPhat
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    List <Post>         posts         = new List <Post>();
                    List <GalleryImage> galleryImages = new List <GalleryImage>();
                    string[]            strArrays     = ids;
                    for (int i = 0; i < (int)strArrays.Length; i++)
                    {
                        int  num  = int.Parse(strArrays[i]);
                        Post post = this._postService.Get((Post x) => x.Id == num, false);
                        galleryImages.AddRange(post.GalleryImages.ToList <GalleryImage>());
                        post.AttributeValues.ToList <AttributeValue>().ForEach((AttributeValue att) => post.AttributeValues.Remove(att));
                        posts.Add(post);
                    }
                    this._galleryService.BatchDelete(galleryImages);
                    this._postService.BatchDelete(posts);

                    //Delete localize
                    for (int i = 0; i < ids.Length; i++)
                    {
                        IEnumerable <LocalizedProperty> ieLocalizedProperty
                            = _localizedPropertyService.GetLocalizedPropertyByEntityId(int.Parse(ids[i]));
                        this._localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ExtentionUtils.Log(string.Concat("Post.Delete: ", exception.Message));
            }
            return(base.RedirectToAction("Index"));
        }