Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
 /// <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()
         });
     }
 }
Esempio n. 3
0
        public IHttpActionResult DeleteHardware(int id)
        {
            var hardware = _repository.Delete(id);

            return(Ok(MapBackToDto(hardware)));
        }