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