public async Task <IHttpActionResult> Delete(string moniker, int talkId) { try { Talk talk = await _repository.GetTalkByMonikerAsync(moniker, talkId, true); if (talk == null) { return(NotFound()); } _repository.DeleteTalk(talk); if (await _repository.SaveChangesAsync()) { //return Ok(); return(StatusCode(HttpStatusCode.NoContent)); } } catch (Exception ex) { return(InternalServerError(ex)); } return(InternalServerError()); }
public async Task <IHttpActionResult> Delete(string moniker, int talkId) { try { var talk = await _repository.GetTalkByMonikerAsync(moniker, talkId); if (talk == null) { return(NotFound()); } _repository.DeleteTalk(talk); if (await _repository.SaveChangesAsync()) { return(Ok()); } else { return(InternalServerError()); } } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <IHttpActionResult> Delete(string moniker, int talkId) { try { //if (ModelState.IsValid) { var talko = await cr.GetTalkByMonikerAsync(moniker, talkId); if (null == talko) { return(NotFound()); } else { cr.DeleteTalk(talko); return(Ok()); } } } catch (Exception e) { return(InternalServerError()); } return(BadRequest()); }
public async Task <IHttpActionResult> Put(string moniker, int talkId) { try { if (ModelState.IsValid) { var talk = await _campsRepository.GetTalkByMonikerAsync(moniker, talkId); if (talk == null) { return(NotFound()); } //Mapping _campsRepository.DeleteTalk(talk); if (await _campsRepository.SaveChangesAsync()) { return(Ok()); } } } catch (Exception ex) { return(InternalServerError(ex)); } return(BadRequest(ModelState)); }
public async Task <IHttpActionResult> DeleteTalk(string moniker, int talkId) { var talk = await _db.GetTalkByMonikerAsync(moniker, talkId); if (talk == null) { return(NotFound()); } _db.DeleteTalk(talk); await _db.SaveChangesAsync(); return(Ok()); }
public async Task <IHttpActionResult> DeleteTalk(string moniker, int id) { try { var talk = await _repository.GetTalkByMonikerAsync(moniker, id); _repository.DeleteTalk(talk); if (await _repository.SaveChangesAsync()) { return(Ok()); } } catch (Exception ex) { return(InternalServerError(ex)); } return(BadRequest()); }