public async Task <OfficeDto> UpdateOffice(int id, OfficeDto office) { var dbOffice = await _context.Offices.FindAsync(id); dbOffice.Name = office.Name; dbOffice.Adress = office.Adress; dbOffice.SwishNumber = office.SwishNumber; dbOffice.Info = office.Info; await _context.SaveChangesAsync(); return(OfficeTranslator.ToOfficeDto(dbOffice)); }
public async Task <OfficeDto> CreateOffice(OfficeDto office) { var newOffice = new Office() { Name = office.Name, Adress = office.Adress, SwishNumber = office.SwishNumber }; _context.Offices.Add(newOffice); await _context.SaveChangesAsync(); return(OfficeTranslator.ToOfficeDto(newOffice)); }