Example #1
0
        public async Task <IActionResult> UpdateBomList(BomList bomListForUpdate)
        {
            var listFromRepo = await _repo.GetBomListById(bomListForUpdate.Id);

            var componentFromRepo = await _search.GetComponentBuhNr(bomListForUpdate.BuhNr);


            if (componentFromRepo != null)
            {
                listFromRepo.BuhNr         = bomListForUpdate.BuhNr;
                listFromRepo.ComponentasId = componentFromRepo.Id;
                listFromRepo.ManufPartNr   = componentFromRepo.Mnf;
            }

            if (await _search.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception($"Updating failed on save");
        }