示例#1
0
        public async Task <ActionResult <ZIFile> > Post([FromBody] ZIFile file)
        {
            this._repo.SaveBytesToFileSystem(file);
            file.Id = Guid.NewGuid().ToString("N");
            await _repo.Create(file);

            return(new OkObjectResult(file));
        }
示例#2
0
        public async Task <ActionResult <ZIFile> > Put(String id, [FromBody] ZIFile file)
        {
            var fileFromDb = await _repo.Get(id);

            if (fileFromDb == null)
            {
                return(new NotFoundResult());
            }
            file.Id         = fileFromDb.Id;
            file.InternalId = fileFromDb.InternalId;
            file.Path       = fileFromDb.Path;
            await _repo.Update(file);

            return(new OkObjectResult(file));
        }