Esempio n. 1
0
        public async Task <PlacardInfo> GetPlacardInfoAsync(int id)
        {
            var placard = await _placardService.GetSpecificPlacardAsync(id);

            var user = await _userService.GetUserAsync(placard.UserId);

            var resourse = _mapper.Map(placard, new PlacardInfo());

            resourse.UserPicture = user.ProfilePicture;
            resourse.UserName    = user.Name;
            resourse.UserLogin   = user.UserName;
            return(resourse);
        }
        public async Task <IActionResult> Post([FromBody] SupporterResourse supporter)
        {
            var user = await _userService.GetUserInfoAsync(supporter.UserId);

            var card = await _placardService.GetSpecificPlacardAsync(supporter.CardId);

            if (user == null || card == null)
            {
                return(NotFound());
            }


            var resourse = _mapper.Map(supporter, new Supporter());
            await _supporterService.UpdateSupporter(resourse);

            return(Ok());
        }