Exemplo n.º 1
0
        public async Task <IHttpActionResult> PostAsync([FromBody] FileItem model, CancellationToken cancellationToken)
        {
            ModelState.Remove("model.Slug");
            if (model == null || !ModelState.IsValid)
            {
                return(BadRequest());
            }

            var manager = new DriveManager(ApiSecurity.Manager, _services, ServerPaths.Map(ServerPaths.DriveFiles));

            model = await manager.CreateAsync(model, ApiSecurity.CurrentUserId, cancellationToken);

            return(CreatedAtRoute(GetByIdRouteName, new RouteValueDictionary {
                { "id", model.Id }
            }, model));
        }