Ejemplo n.º 1
0
        public ActionResult EditProduct(EditProductModel model, HttpPostedFileBase[] Image)
        {
            string path = Server.MapPath(ConfigurationManager.AppSettings["imagesPath"]);

            string miniPath = Server.MapPath(ConfigurationManager.AppSettings["MiniImages"]);

            postRepository.DeleteImages(model.Id, path, miniPath);
            postRepository.EditProduct(model.Id, model.Title, model.Description, model.Quantity, model.IsIn, Image, model.categoryId, model.Price, path, miniPath);

            return(RedirectToAction("Products", "admin"));
        }
Ejemplo n.º 2
0
        public static async void Run([QueueTrigger("process-delete-post", Connection = "QUEUESTORAGE_CONNECTION")] CloudQueueMessage myQueueItem, TraceWriter log)
        {
            string[] queueItemList = myQueueItem.AsString.Split('.');
            string   trackId       = queueItemList[0];
            string   postId        = queueItemList[1];

            var post = await PostRepository.GetPost(trackId, postId);

            PostRepository.DeletePostFromTableStorage(post);
            PostRepository.DeletePostFromCosmos(postId);

            if (post.has_image)
            {
                PostRepository.DeleteImages(postId);
            }

            // TODO: delete from feeds
            log.Info($"Deleted post: {post.RowKey}");
        }