public async Task <int> InsertUserSeenTvShowAsync(CreateUserSeenTvShowCommand command) { try { RequestHelper.GetStringContentFromObject(command); var result = await client.PostAsync($"{baseUrl}/api/UserSeenTvShows/", RequestHelper.GetStringContentFromObject(command)); return(Convert.ToInt32(result.Content.ReadAsStringAsync().Result)); } catch (Exception e) { throw; } }
public async Task <ActionResult <int> > Post([FromBody] CreateUserSeenTvShowCommand command) { try { var entity = new UserSeenTvShow { TvShowId = command.TvShowId, UserId = command.UserId, CreatedAt = DateTime.Now, }; _context.UserSeenTvShows.Add(entity); await _context.SaveChangesAsync(); return(Ok(entity.Id)); } catch (Exception e) { throw; } }