private Window Convert(WindowDto windowDto, bool isUpdate) { var window = new Window() { Model = windowDto.Model, Color = windowDto.Color, Description = windowDto.Description, Having = windowDto.Having, Image = windowDto.Image, ManufactorId = windowDto.ManufactorId, Manufactor = repositories.manufactorRepository.GetById(windowDto.ManufactorId), Price = windowDto.Price }; if (isUpdate) { window.Id = windowDto.Id; } return(window); }
public void EditWindow(WindowDto window) { repositories.windowRepository.Update(Convert(window, true)); }
public void AddWindow(WindowDto windowDto) { repositories.windowRepository.Create(Convert(windowDto, false)); }