public async Task <Component> Add(AddComponentCommand command) { var component = new Component { Id = Guid.NewGuid(), Name = command.Name, Amount = command.Amount }; await _componentRepository.Add(component); return(component); }
public async Task <Component> Add(AddComponentCommand command) { var component = new Component { Id = Guid.NewGuid(), Name = command.Name, Brand = command.Brand, Description = command.Description, ImagePath = command.ImagePath, Price = command.Price, Amount = command.Amount, Type = command.Type }; await _componentRepository.Add(component); return(component); }
private ComponentWrapper CreateNewComponent() //calls the add method in the repository to insert new equipment and return it { var component = new ComponentWrapper(new Model.Component()); //when property in equipment changes, and it has errors, disable the create button component.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(Component.HasErrors)) { ((DelegateCommand)CreateComponentCommand).RaiseCanExecuteChanged(); } }; ((DelegateCommand)CreateComponentCommand).RaiseCanExecuteChanged(); //default values component.ComponentType = ""; component.ComponentSupplyNumber = ""; component.ComponentSerialNumber = ""; _componentRepository.Add(component.Model); //context is aware of the equipment to add return(component); }
public void AddComponent(params Component[] Components) { _componentRepository.Add(Components); }