public HttpResponseMessage DeleteHardware(int id) { try { _hardwareRepository.Delete(id); HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); return(response); } catch (Exception) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NotFound); return(response); } }
/// <summary> /// The Delete /// </summary> /// <param name="entity">The entity<see cref="Hardware"/></param> /// <returns>The <see cref="ServiceResult"/></returns> public ServiceResult Delete(Hardware entity) { try { _repository.Delete(entity); return(new ServiceResult(true)); } catch (Exception ex) { return(new ServiceResult(false) { Error = ex.ToString() }); } }
public IHttpActionResult DeleteHardware(int id) { var hardware = _repository.Delete(id); return(Ok(MapBackToDto(hardware))); }