Ejemplo n.º 1
0
 public IEnumerable <Publicacion> Get()
 {
     using (var context = new TallerContext())
     {
         return(context.Publicaciones.ToList());
     }
 }
Ejemplo n.º 2
0
 public Publicacion Get(int id)
 {
     using (var context = new TallerContext())
     {
         return(context.Publicaciones.FirstOrDefault(x => x.Id == id));
     }
 }
Ejemplo n.º 3
0
 public bool Delete(int id)
 {
     using (var context = new TallerContext())
     {
         var publicacionDel = context.Publicaciones.FirstOrDefault(x => x.Id == id);
         context.Publicaciones.Remove(publicacionDel);
         context.SaveChanges();
         return(true);
     }
 }
Ejemplo n.º 4
0
 public IHttpActionResult post(Publicacion publicacion)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     using (var context = new TallerContext())
     {
         context.Publicaciones.Add(publicacion);
         context.SaveChanges();
         return(Ok(publicacion));
     }
 }
Ejemplo n.º 5
0
        public Publicacion Put(Publicacion publicacion)
        {
            using (var context = new TallerContext())
            {
                var publicacionAct = context.Publicaciones.FirstOrDefault(x => x.Id == publicacion.Id);
                publicacionAct.Usuario         = publicacion.Usuario;
                publicacionAct.Descripcion     = publicacion.Descripcion;
                publicacionAct.Usuario         = publicacion.Usuario;
                publicacionAct.MeGusta         = publicacion.MeGusta;
                publicacionAct.MeDisgusta      = publicacion.MeDisgusta;
                publicacionAct.VecesCompartido = publicacion.VecesCompartido;

                context.SaveChanges();
                return(publicacion);
            }
        }
        public LoginController(TallerContext context, IOptions <AppSetting> appSettings)
        {
            _context = context;
            var admin = _context.Users.Find("admin");

            if (admin == null)
            {
                _context.Users.Add(new User()
                {
                    UserName    = "******",
                    Password    = "******",
                    Email       = "*****@*****.**",
                    Estado      = "ADMIN",
                    FirstName   = "Adminitrador",
                    LastName    = "",
                    MobilePhone = "31800000000"
                }
                                   );
                var registrosGuardados = _context.SaveChanges();
            }
            _userService = new UserService(context);
            _jwtService  = new JwtService(appSettings);
        }
Ejemplo n.º 7
0
 public UsuarioRepository(TallerContext context)
 {
     _context = context;
 }
 public VehiculoService(TallerContext context)
 {
     _context = context;
 }
Ejemplo n.º 9
0
 public ProductoService(TallerContext context)
 {
     _context = context;
 }
 public EmpleadoService(TallerContext context)
 {
     _context = context;
 }
Ejemplo n.º 11
0
 public VentaRepository(TallerContext context)
 {
     _context = context;
 }
 public CitaController(TallerContext context)
 {
     citaService = new CitaService(context);
 }
 public ClienteService(TallerContext context)
 {
     _context = context;
 }
 public CitaService(TallerContext context)
 {
     _context = context;
 }
Ejemplo n.º 15
0
 public DetalleService(TallerContext context)
 {
     _context = context;
 }
 public DetalleController(TallerContext context)
 {
     detalleservice = new DetalleService(context);
 }
Ejemplo n.º 17
0
 public UserService(TallerContext context) => _context = context;
 public ServicioService(TallerContext context)
 {
     _context = context;
 }