Exemplo n.º 1
0
        public async Task Update([FromBody] ChangedSponsor model)
        {
            await Validate(model);

            model.Approved = Actor.IsRegistrar;

            await SponsorService.AddOrUpdate(model);
        }
Exemplo n.º 2
0
        public async Task CreateBatch([FromBody] ChangedSponsor[] model)
        {
            foreach (var s in model)
            {
                s.Approved = Actor.IsRegistrar;

                await SponsorService.AddOrUpdate(s);
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResult <Sponsor> > UploadImage(IFormFile file)
        {
            AuthorizeAny(
                () => Actor.IsRegistrar
                );

            string filename = file.FileName.ToLower();

            string path = Path.Combine(Options.ImageFolder, filename);

            using (var stream = new FileStream(path, FileMode.Create))
            {
                await file.CopyToAsync(stream);
            }

            await SponsorService.AddOrUpdate(
                Path.GetFileNameWithoutExtension(filename),
                filename
                );

            return(Ok(new UploadedFile {
                Filename = filename
            }));
        }