Exemplo n.º 1
0
        public JsonResult DeleteFiles(IEnumerable <string> filePathes = null)
        {
            var model = new DeleteFilesModel();

            if (filePathes == null)
            {
                AddMessage(MessageType.Error, Resources.UI.NoFilesAreSelected);

                return(Json(model));
            }

            foreach (var file in filePathes)
            {
                try
                {
                    _webdavManager.DeleteResource(Server.UrlDecode(file));

                    model.DeletedFiles.Add(file);
                }
                catch (WebDavException exception)
                {
                    model.AddMessage(MessageType.Error, exception.Message);
                }
            }

            if (model.DeletedFiles.Any())
            {
                model.AddMessage(MessageType.Success, string.Format(Resources.UI.ItemsWasRemovedFormat, model.DeletedFiles.Count));
            }

            return(Json(model));
        }
Exemplo n.º 2
0
 public HttpResponseMessage DeleteFiles(DeleteFilesModel model)
 {
     return(fileService.Delete(model, Request));
 }
Exemplo n.º 3
0
 public HttpResponseMessage Delete(DeleteFilesModel model, HttpRequestMessage request)
 {
     fileManager.Delete(model.Path, model.Names);
     return(request.CreateResponse(HttpStatusCode.OK, string.Format(Resources.FilesHaveBeenRemoved)));
 }