public IHttpActionResult AddHistories(HistoriaEntity model)
        {
            try
            {
                using (var ts = new TransactionScope())
                {
                    Historia historia = new Historia();
                    if (!model.HistoriaId.HasValue)
                    {
                        context.Historia.Add(historia);
                        historia.Estado        = ConstantHelpers.ESTADO.ACTIVO;
                        historia.FechaRegistro = DateTime.Now;
                    }

                    historia.UsuarioId = model.UsuarioId;
                    historia.Argumento = model.Argumento;
                    historia.Precio    = model.Precio;
                    historia.Editorial = model.Editorial;
                    historia.Imagen    = model.Imagen;

                    context.SaveChanges();
                    ts.Complete();
                }
                response.Data    = "Historia Agregada con éxito";
                response.Error   = false;
                response.Message = "Success";
                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(Unauthorized());
            }
        }
        public IHttpActionResult EditHistories(HistoriaEntity model)
        {
            try
            {
                using (var ts = new TransactionScope())
                {
                    Historia historia = new Historia();
                    if (model.HistoriaId.HasValue)
                    {
                        historia = context.Historia.FirstOrDefault(x => x.HistoriaId == model.HistoriaId);
                    }

                    historia.UsuarioId = model.UsuarioId;
                    historia.Argumento = model.Argumento;
                    historia.Precio    = model.Precio;
                    historia.Editorial = model.Editorial;
                    historia.Imagen    = model.Imagen;

                    context.SaveChanges();
                    ts.Complete();
                }
                response.Data    = "Historia Actualizada con éxito";
                response.Error   = false;
                response.Message = "Success";
                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(Unauthorized());
            }
        }