コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
 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;
         }
     }
 }
コード例 #3
0
 public Schedule Insert(Schedule schedule)
 {
     if (schedule == null)
     {
         throw new NotImplementedException();
     }
     else
     {
         agendaonline1Entities bd = new agendaonline1Entities();
         bd.Schedule.Add(schedule);
         bd.SaveChanges();
         return(schedule);
     }
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
 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);
         }
     }
 }
コード例 #7
0
 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);
         }
     }
 }
コード例 #8
0
        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;
                }
            }
        }