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 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 Schedule Insert(Schedule schedule) { if (schedule == null) { throw new NotImplementedException(); } else { agendaonline1Entities bd = new agendaonline1Entities(); bd.Schedule.Add(schedule); bd.SaveChanges(); return(schedule); } }
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 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; } } }