public async Task <IActionResult> Editar(int AgendamentoID, [Bind("AgendamentoID, Data, PacienteID, MedicoID")] Models.Agendamento agendamento)
        {
            if (AgendamentoID != agendamento.AgendamentoID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(agendamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExisteAgendamento(agendamento.AgendamentoID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(agendamento));
        }
Exemple #2
0
        public async Task <Models.Agendamento> Remove(Models.Agendamento agendamento, string token = "")
        {
            await Task.Delay(10);

            agendamentos.Remove(agendamento);

            return(null);
        }
Exemple #3
0
        public async Task <Models.Agendamento> Post(Models.Agendamento agendamento)
        {
            await Task.Delay(10);

            agendamento.Id = agendamentos.Last().Id + 1;

            agendamentos.Add(agendamento);

            return(agendamento);
        }
Exemple #4
0
 public ActionResult DataClinica(Models.Agendamento agendamento)
 {
     if (ModelState.IsValid)
     {
         var cookie = new HttpCookie("agendamento", JsonConvert.SerializeObject(agendamento));
         cookie.Expires.AddHours(1);
         HttpContext.Response.Cookies.Add(cookie);
         return(Json(new { ok = true, Url = Url.Action("Entrar") }));
     }
     return(View());
 }
        public async Task <IActionResult> Adicionar([Bind("AgendamentoID, Data, PacienteID, MedicoID")] Models.Agendamento agendamento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(agendamento);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(agendamento));
        }
        public void Inserir(Models.Agendamento agendamentoModel)
        {
            Persistence.Agendamento _tbAgendamento = new Persistence.Agendamento();
            _tbAgendamento.Id            = agendamentoModel.Id;
            _tbAgendamento.Hora          = agendamentoModel.Hora;
            _tbAgendamento.IdCliente     = agendamentoModel.Id_Cliente;
            _tbAgendamento.IdEmpresa     = agendamentoModel.Id_Empresa;
            _tbAgendamento.IdFuncionario = agendamentoModel.Id_Funcionario;
            _tbAgendamento.Data          = agendamentoModel.Data;
            _tbAgendamento.Status        = agendamentoModel.Status;

            _context.Add(_tbAgendamento);
            _context.SaveChanges();
        }
 public void Editar(Models.Agendamento agendamentoModel)
 {
     try
     {
         Persistence.Agendamento tbagendamento = new Persistence.Agendamento();
         Atribuir(agendamentoModel, tbagendamento);
         _context.Update(tbagendamento);
         _context.SaveChanges();
     }
     catch (Exception e)
     {
         throw new Exception($"Agendamento não atualizado. Erro de {e.Message}");
     }
 }
 private void Atribuir(Models.Agendamento agendamentoModel, Persistence.Agendamento tbagendamento)
 {
     try
     {
         tbagendamento.Id            = agendamentoModel.Id;
         tbagendamento.IdCliente     = agendamentoModel.Id_Cliente;
         tbagendamento.IdEmpresa     = agendamentoModel.Id_Empresa;
         tbagendamento.IdFuncionario = agendamentoModel.Id_Funcionario;
         tbagendamento.Status        = agendamentoModel.Status;
         tbagendamento.Hora          = agendamentoModel.Hora;
         tbagendamento.Data          = agendamentoModel.Data;
     }
     catch (Exception e)
     {
         throw new Exception($"Dados não atribuidos. Erro {e.Message}");
     }
 }
        public JObject CriarAgendamento(Models.Agendamento agendamento)
        {
            JObject obj = new JObject();

            Models.ModelsBusiness.AgendamentoBusiness agBusiness = new Models.ModelsBusiness.AgendamentoBusiness();
            Models.Agendamento ag = agBusiness.SalvarAgendamento(agendamento);

            if (ag != null)
            {
                obj.Add(new JProperty("status", "ok"));
            }
            else
            {
                obj.Add(new JProperty("status", "erro"));
            }

            return(obj);
        }
Exemple #10
0
 public Task <Models.Agendamento> Remove(Models.Agendamento agendamento, string token = "")
 {
     throw new NotImplementedException();
 }
Exemple #11
0
 public Task <Models.Agendamento> Post(Models.Agendamento agendamento)
 {
     throw new NotImplementedException();
 }