public ActionResult <IEnumerable <UserViewModel> > GetAffiliateUsers(int affiliateId) { if (!_affiliateService.Exist(affiliateId)) { return(NotFound()); } return(_userService.GetAffiliateUsers(affiliateId).Select(x => UserMapper.DTOtoUserViewModel(x)).ToArray()); }
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()); }
public ActionResult <IEnumerable <ScheduleViewModel> > GetSchedule(int affiliateId) { if (!_affiliateService.Exist(affiliateId)) { return(NotFound()); } return(_scheduleService.GetAffiliateSchedule(affiliateId).Select(s => ScheduleMapper.DTOtoScheduleVM(s)).ToArray()); }