//DELETE file from Amazon server
        public bool DeleteFile(int id)
        {
            bool retVal = false;

            UserFile            fileInfo = FileMetaService.FileGetById(id);
            AmazonDeleteRequest payload  = new AmazonDeleteRequest();

            payload.Id      = fileInfo.ID;
            payload.FileUrl = fileInfo.FileUrl;

            retVal = _uploadService.DeleteFileFromS3(payload);

            if (retVal)
            {
                fms.FileDelete(payload.Id);
            }
            ;
            return(retVal);
        }
예제 #2
0
        public HttpResponseMessage FileGetByFileId(int Id)
        {
            try
            {
                ItemResponse <UserFile> response = new ItemResponse <UserFile>();

                response.Item = FileMetaService.FileGetById(Id);

                return(Request.CreateResponse(response));
            }
            catch (Exception ex)
            {
                ErrorLogService    svc   = new ErrorLogService();
                ErrorLogAddRequest error = new ErrorLogAddRequest();
                error.ErrorFunction = "Sabio.Web.Controllers.Api.GetAddresses";
                error.ErrorMessage  = ex.Message;
                error.UserId        = UserService.UserSelect().PersonId;
                svc.ErrorLogInsert(error);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }