public async Task <IActionResult> Post([FromBody] BinDto bin) { var newBin = new Bin() { Code = bin.Code, Name = bin.Name, Description = bin.Description, }; await _repository.AddAsync(newBin); return(Ok(BinDto.FromBin(newBin))); }
public async Task <IActionResult> Put([FromBody] BinDto bin) { var updatedBin = new Bin() { Id = bin.Id, Code = bin.Code, Name = bin.Name, Description = bin.Description }; await _repository.UpdateAsync(updatedBin); return(Ok(BinDto.FromBin(updatedBin))); }
public async Task <IActionResult> GetById(int id) { var item = BinDto.FromBin(await _repository.GetByIdAsync(id)); return(Ok(item)); }