Пример #1
0
        public async Task InsertAsync(int postageId)
        {
            var userId = _logged.GetUserLoggedId();

            var likesExistForPostage = await _likesRepository
                                       .GetByUserIdAndPostageIdAsync(userId, postageId)
                                       .ConfigureAwait(false);

            if (likesExistForPostage != null)
            {
                await _likesRepository
                .DeleteAsync(likesExistForPostage.Id)
                .ConfigureAwait(false);
            }

            var like = new Likes(postageId, userId);
            //Validar os dados obriatorios..

            await _likesRepository
            .InsertAsync(like)
            .ConfigureAwait(false);
        }