public List <Schedule> Get(string var, string data) { if (var == "") { throw new NotImplementedException(); } else { DateTime date = DateTime.Parse(data); agendaonline1Entities bd = new agendaonline1Entities(); var schedule = (from p in bd.People join s in bd.Schedule on p.idPeople equals s.idPeople where (p.cpf == var || p.name.Contains(var))// && s.date == date select new { s }).ToList(); List <Schedule> schedulesFinal = new List <Schedule>(); foreach (var list in schedule) { Schedule s = new Schedule(); s.client = list.s.client; s.date = list.s.date; s.idPeople = list.s.idPeople; s.idSchedule = list.s.idSchedule; s.idService = list.s.idService; s.status = list.s.status; schedulesFinal.Add(s); } return(schedulesFinal); } }
public Service Update(Service service) { if (service == null) { throw new NotImplementedException(); } else { M try { agendaonline1Entities bd = new agendaonline1Entities(); var serviceUpdate = bd.Service.Single(s => s.idService == service.idService); serviceUpdate.ative = service.ative; serviceUpdate.cpfStore = service.cpfStore; serviceUpdate.price = service.price; serviceUpdate.service1 = service.service1; bd.SaveChanges(); return(service); } catch (Exception ex) { throw ex; } } }
public Users Insert(Users user) { DateTime date = Convert.ToDateTime(user.created_At); if (user == null) { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); user.created_At = date; try { bd.Users.Add(user); bd.SaveChanges(); return(user); } catch (Exception ex) { return(null); } } }
public Users Get(string user, string password) { if (user == "" && password == "") { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); var aut = bd.Users.FirstOrDefault(s => s.email == user && s.password == password); return(aut); } }
public IEnumerable <Service> Get(string cpfStore) { if (cpfStore == "") { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); var servicesList = bd.Service.Where(s => s.cpfStore == cpfStore).ToList(); return(servicesList); } }
public Schedule Insert(Schedule schedule) { if (schedule == null) { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); bd.Schedule.Add(schedule); bd.SaveChanges(); return(schedule); } }
public List <Service> Get(string cpfStore, string service, string status) { if ((cpfStore == "" && service == "") || (cpfStore == "" && status == "")) { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); var servicesList = bd.Service.Where(s => s.cpfStore == cpfStore && s.service1 == service || s.cpfStore == cpfStore && s.ative.Trim() == status.Trim()).ToList(); return(servicesList); } }
public Schedule Update(Schedule schedule) { if (schedule == null) { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); var scheduleUpdate = bd.Schedule.Single(s => s.idSchedule == schedule.idSchedule); scheduleUpdate = schedule; bd.SaveChanges(); return(schedule); } }
public People Update(People people) { if (people == null) { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); People peopleUpdate = bd.People.Single(s => s.cpf == people.cpf); peopleUpdate.city = people.city; peopleUpdate.cpf = people.cpf; peopleUpdate.email = people.email; peopleUpdate.name = people.name; peopleUpdate.phone = people.phone; peopleUpdate.uf = people.uf; bd.SaveChanges(); return(people); } }
public List <People> Get(string cpf) { if (cpf == "") { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); var people = bd.People.Where(s => s.cpf.Equals(cpf)).ToList(); if (people.Count > 0) { return(people); } else { return(people); } } }
public Schedule UpdateStatus(int id) { if (id <= 0) { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); var scheduleUpdate = bd.Schedule.SingleOrDefault(s => s.idSchedule == id); if (scheduleUpdate != null) { scheduleUpdate.status = "Fechado"; bd.SaveChanges(); return(scheduleUpdate); } else { return(null); } } }
public People Insert(People people) { if (people == null) { throw new NotImplementedException(); } else { var valida = this.Get(people.cpf); if (valida.Count == 0) { agendaonline1Entities bd = new agendaonline1Entities(); bd.People.Add(people); bd.SaveChanges(); return(people); } else { return(null); } } }
public Service Inset(Service service) { if (service == null) { throw new NotImplementedException(); } else { try { service.ative = service.ative.Trim(); agendaonline1Entities bd = new agendaonline1Entities(); bd.Service.Add(service); bd.SaveChanges(); return(service); } catch (Exception ex) { throw ex; } } }