예제 #1
0
        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)));
        }
예제 #2
0
        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)));
        }
예제 #3
0
        public async Task <IActionResult> GetById(int id)
        {
            var item = BinDto.FromBin(await _repository.GetByIdAsync(id));

            return(Ok(item));
        }