public async Task <HttpResponseMessage> Post() { var requestContent = Request.Content; var jsonContent = await requestContent.ReadAsStringAsync(); return(JsonResponse.JsonHttpResponse <object>(_takenBookPresenter.IsTaken(jsonContent))); }
public async Task <HttpResponseMessage> Put() { var requestContent = Request.Content; var jsonContent = await requestContent.ReadAsStringAsync(); var data = JsonConvert.DeserializeObject <Code>(jsonContent); if (!_takenBookPresenter.IsTaken(data.isbnCode)) { await _takenBookPresenter.TakeBook(data.isbnCode, data.user); try { var returnDate = DateTime.UtcNow.AddDays(30); var s = returnDate.ToString("MM/dd/yyyy"); return(JsonResponse.JsonHttpResponse <object>(s)); } catch (InvalidOperationException) { return(JsonResponse.JsonHttpResponse <object>(false)); } } return(JsonResponse.JsonHttpResponse <object>(false)); }