public PlatformDto AddPlatform(PlatformDto platformDto) { var platform = new Platform { Name = platformDto.Name, Notes = platformDto.Notes, Company = _context.Companies.Find(platformDto.CompanyId) }; var addedPlatform = _context.Platforms.Add(platform); _context.SaveChanges(); var addedPlatformDto = Mapper.Map<Platform, PlatformDto>(addedPlatform); return addedPlatformDto; }
public void UpdatePlatform(PlatformDto platformDto) { var platform = _context.Platforms.Find(platformDto.Id); platform.Name = platformDto.Name; platform.Notes = platformDto.Notes; platform.Company = _context.Companies.Find(platformDto.CompanyId); _context.SaveChanges(); }