Example #1
0
        public async Task <IActionResult> UpdateMeshProduct(int id, MeshProductForEditDto meshProductForUpdateDto)
        {
            var meshProductFromRepo = await _repo.GetMeshProduct(id);

            _mapper.Map(meshProductForUpdateDto, meshProductFromRepo);

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

            throw new Exception($"Updating mesh product {id} failed on save");
        }
        public async Task <IActionResult> AddMeshEfectivity(MeshEfectivity meshEfectivity)
        {
            var meshEfectivityForAdd = _mapper.Map <MeshEfectivityDto>(meshEfectivity);

            _repo.Add(meshEfectivity);

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

            throw new Exception($"Add mesh product {meshEfectivityForAdd.Id} failed on save");
        }