Ejemplo n.º 1
0
        public async Task PostOrganization([FromForm] OrganizationDto organizationDto)
        {
            var newOrganization = new Organization();

            organizationDto.UpdateEntity(newOrganization);

            dbContext.Organizations.Add(newOrganization);
            await dbContext.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public async Task PutOrganization([FromForm] OrganizationDto organizationDto)
        {
            Organization organization = await dbContext.Organizations
                                        .Include(o => o.File)
                                        .FirstOrDefaultAsync(o => o.Id == organizationDto.Id);

            if (organizationDto.File != null && organization.File != null)
            {
                dbContext.Files.Remove(organization.File);
            }

            organizationDto.UpdateEntity(organization);
            await dbContext.SaveChangesAsync();
        }