示例#1
0
        ////Metodo GetByName
        //public HttpResponseMessage GetByName(string name)
        //{
        //    ClienteT items = c.GetByName(name);
        //    if (items == null)
        //    {
        //        //Construyendo respuesta del servidor
        //        return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No hay ningun cliente con el nombre "+name);
        //    }
        //    return Request.CreateResponse(HttpStatusCode.OK, items);
        //}
        //Metodo Delete
        public HttpResponseMessage Delete(int id)
        {
            var item = c.GetById(id);

            if (item == null)
            {
                //Construyendo respuesta del servidor
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No hay ningun doctor con el id " + id + " para eliminar"));
            }
            c.Delete(id);
            return(Request.CreateResponse(HttpStatusCode.OK, "El registro ha sido eliminado"));
        }
示例#2
0
 public string Delete(int id)
 {
     try
     {
         Doctor deleteDoctor = context.Doctors.Single(s => s.DoctorId == id);
         doctor.Delete(deleteDoctor);
         return($"Doctor is deleted successfully...");
     }
     catch (Exception)
     {
         return($"Doctor isn't deleted...");
     }
 }
示例#3
0
        public async Task <ResultEntity> Delete(int idDoctor)
        {
            try
            {
                var result = await _doctorRepository.Delete(idDoctor);

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }