public IHttpActionResult Put(cita cita)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid data"));
            }

            using (var ctx = new usrEntities3())
            {
                var existingcita = ctx.cita.Where(s => s.Id == cita.Id).FirstOrDefault <cita>();

                if (existingcita != null)
                {
                    existingcita.titulo     = cita.titulo;
                    existingcita.inicio     = cita.inicio;
                    existingcita.estatus    = cita.estatus;
                    existingcita.IdTipoCita = cita.IdTipoCita;

                    ctx.SaveChanges();
                }
                else
                {
                    return(NotFound());
                }
            }
            return(Ok());
        }
        public IHttpActionResult Delete(Guid?Id)
        {
            if (Id == null || Id == Guid.Empty)
            {
                return(BadRequest("Not a valid appointment id"));
            }

            using (var ctx = new usrEntities3())
            {
                var cita = ctx.cita
                           .Where(s => s.Id == Id)
                           .FirstOrDefault();
                if (cita != null)
                {
                    ctx.Entry(cita).State = System.Data.Entity.EntityState.Deleted;
                    ctx.SaveChanges();
                }
                else
                {
                    return(NotFound());
                }
            }

            return(Ok());
        }
        public IHttpActionResult PostNewCitas(cita cita)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new usrEntities3())
            {
                ctx.cita.Add(new cita()
                {
                    Id         = Guid.NewGuid(),
                    titulo     = cita.titulo,
                    inicio     = cita.inicio,
                    estatus    = "active",
                    IdTipoCita = cita.IdTipoCita
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }