public ActionResult Delete(int[] ids) { try { if (ids.Length != 0) { var numArray = ids; for (var i = 0; i < numArray.Length; i++) { var num = numArray[i]; var slideShow = _slideShowService.Get(x => x.Id == num); _slideShowService.Delete(slideShow); //Delete localize var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(num); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception ex) { ExtentionUtils.Log(string.Concat("SlideShow.Delete: ", ex.Message)); } return(RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { var contactInformations = from id in ids select _contactInfoService.GetById(int.Parse(id)); _contactInfoService.BatchDelete(contactInformations); //Delete localize for (var i = 0; i < ids.Length; i++) { var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception exception1) { var exception = exception1; ExtentionUtils.Log(string.Concat("ContactInformation.Delete: ", exception.Message)); } return(RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { var menuLinks = from id in ids select _menuLinkService.GetMenu(int.Parse(id)); _menuLinkService.BatchDelete(menuLinks); //Delete localize for (var i = 0; i < ids.Length; i++) { var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception ex) { LogText.Log(string.Concat("MenuLink.Delete: ", ex.Message)); ModelState.AddModelError("", ex.Message); } return(RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.IsAny()) { var idTest = from id in ids select id; var aa = idTest.FirstOrDefault(); var genericControls = from id in ids select _gCService.GetById(int.Parse(id)); _gCService.BatchDelete(genericControls); //Delete localize for (var i = 0; i < ids.Length; i++) { var localizedProperties = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); _localizedPropertyService.BatchDelete(localizedProperties); } } } catch (Exception ex) { LogText.Log(string.Concat("GenericControl --> Delete: ", ex.Message)); ModelState.AddModelError("", ex.Message); } return(RedirectToAction("Index")); }
public ActionResult Delete(int[] ids) { try { if (ids.Length != 0) { var news = from id in ids select _newsService.GetById(id); _newsService.BatchDelete(news); //Delete localize for (var i = 0; i < ids.Length; i++) { var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(ids[i]); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception exception1) { var exception = exception1; LogText.Log(string.Concat("Post.Delete: ", exception.Message)); } return(RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { var staticContents = from id in ids select _staticContentService.GetById(int.Parse(id)); _staticContentService.BatchDelete(staticContents); ////Check and delete logo exists //string str1 = string.Format("{0}", item.FileName.NonAccent()); //if (System.IO.File.Exists(str)) // System.IO.File.Delete(str); //Delete localize for (var i = 0; i < ids.Length; i++) { var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception ex) { ExtentionUtils.Log(Concat("StaticContent.Delete: ", ex.Message)); } return(RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.IsAny()) { var posts = new List <Post>(); var galleryImages = new List <GalleryImage>(); var orderItems = new List <OrderItem>(); IEnumerable <LocalizedProperty> localizedProperties = null; for (var i = 0; i < ids.Length; i++) { var id = int.Parse(ids[i]); var post = _postService.Get(x => x.Id == id); if (post.GalleryImages.IsAny()) { galleryImages.AddRange(post.GalleryImages.ToList()); } post.AttributeValues.ToList().ForEach(att => post.AttributeValues.Remove(att)); posts.Add(post); var orderItem = _orderItemService.GetByPostId(id); if (orderItem != null) { orderItems.Add(orderItem); } localizedProperties = _localizedPropertyService.GetByEntityId(id); } _galleryService.BatchDelete(galleryImages); _orderItemService.BatchDelete(orderItems); _localizedPropertyService.BatchDelete(localizedProperties); _postService.BatchDelete(posts); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); LogText.Log(string.Concat("Post.Delete: ", ex.Message)); } return(RedirectToAction("Index")); }
public ActionResult Delete(string[] ids) { try { if (ids.Length != 0) { var posts = new List <Post>(); var galleryImages = new List <GalleryImage>(); var strArrays = ids; for (var i = 0; i < strArrays.Length; i++) { var num = int.Parse(strArrays[i]); var post = _postService.Get(x => x.Id == num); galleryImages.AddRange(post.GalleryImages.ToList()); post.AttributeValues.ToList().ForEach(att => post.AttributeValues.Remove(att)); posts.Add(post); } _galleryService.BatchDelete(galleryImages); _postService.BatchDelete(posts); //Delete localize for (var i = 0; i < ids.Length; i++) { var ieLocalizedProperty = _localizedPropertyService.GetByEntityId(int.Parse(ids[i])); _localizedPropertyService.BatchDelete(ieLocalizedProperty); } } } catch (Exception ex) { ExtentionUtils.Log(string.Concat("Post.Delete: ", ex.Message)); } return(RedirectToAction("Index")); }