Пример #1
0
 public static AffiliateDTO UpdateAffiliateVMToDTO(UpdateAffiliateViewModel updateAffiliateViewModel)
 {
     return(new AffiliateDTO
     {
         Id = updateAffiliateViewModel.Id,
         Name = updateAffiliateViewModel.Name
     });
 }
        public IActionResult UpdateAffiliate(int id, [FromBody] UpdateAffiliateViewModel updateAffiliateViewModel)
        {
            if (id != updateAffiliateViewModel.Id)
            {
                return(BadRequest());
            }

            if (!_affiiliateService.Exist(id))
            {
                return(NotFound());
            }

            var affiliateDTO = AffiliateMapper.UpdateAffiliateVMToDTO(updateAffiliateViewModel);

            _affiiliateService.Update(affiliateDTO);

            return(NoContent());
        }