// POST: api/Medias public async Task <int> PostAsync([FromBody] string task) { int records; try { records = await repository.CreateAsync(JsonConvert.DeserializeObject <Media>(task)); } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } return(records); }