public IEnumerable <Publicacion> Get() { using (var context = new TallerContext()) { return(context.Publicaciones.ToList()); } }
public Publicacion Get(int id) { using (var context = new TallerContext()) { return(context.Publicaciones.FirstOrDefault(x => x.Id == id)); } }
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); } }
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)); } }
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); }
public UsuarioRepository(TallerContext context) { _context = context; }
public VehiculoService(TallerContext context) { _context = context; }
public ProductoService(TallerContext context) { _context = context; }
public EmpleadoService(TallerContext context) { _context = context; }
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; }
public DetalleService(TallerContext context) { _context = context; }
public DetalleController(TallerContext context) { detalleservice = new DetalleService(context); }
public UserService(TallerContext context) => _context = context;
public ServicioService(TallerContext context) { _context = context; }