public HttpResponseMessage Guardar(Libro entidad) { var resultado = (HttpResponseMessage)null; try { if (entidad == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new { message = "El modelo no puede ser nulo" })); } if (entidad.Edicion) { entidad.NumeroEjemplares = LibroBL.ObtenerPorISBN(entidad.ISBN).NumeroEjemplares; _libroService.Update(entidad); } else { entidad.NumeroEjemplares = 0; entidad.Estatus = 1; _libroService.Create(entidad); } resultado = Request.CreateResponse(HttpStatusCode.OK, entidad); } catch (Exception exception) { resultado = Request.CreateResponse(HttpStatusCode.InternalServerError, new { message = exception.Message }); } return(resultado); }
public HomeController() { _LibroBL = new SocialNetwork.BL.LibroBL(); _categoriasBL = new SocialNetwork.BL.CategoriasBL(); }
public LibroController() { _LibroBL = new LibroBL(); _categoriasBL = new CategoriasBL(); }
public LibroController() { _libroBL = new LibroBL(); _categoriasBL = new CategoriaBL(); _descargaBL = new DescargaBL(); }