Exemplo n.º 1
0
        public ActionResult saveAppointment(formAppoimtnetViewModel app)
        {
            Session["id"] = "1";
            int pacid  = Convert.ToInt32(Session["id"]);
            var Newapp = app.appoint;
            var pac    = _context.Pacient.SingleOrDefault(m => m.id == pacid);

            if (pac == null)
            {
                return(HttpNotFound());
            }
            Newapp.PacientId = pac.id;
            Newapp.sure      = false;
            if (app.checkout || (app.appoint.StatesId == 0))
            {
                app.appoint.StatesId = _context.States.SingleOrDefault(m => m.Content.Equals("Checkout")).Id;
            }
            //else if(app.appoint.StatesId==0)
            //{
            //    //code for suvey result but now it checkout
            //}
            _context.Appointment.Add(Newapp);
            _context.SaveChanges();
            return(Content(app.appoint.Date.ToShortDateString() + app.appoint.StatesId));
        }
Exemplo n.º 2
0
        public ActionResult FormAppointment(string dt, int docid, int type)
        {
            surveylist survey = _context.surveylist.SingleOrDefault(m => m.Doctorid == docid);

            if (survey == null)
            {
                survey = _context.surveylist.SingleOrDefault(m => m.Doctorid == 1);
            }
            formAppoimtnetViewModel fview = new formAppoimtnetViewModel
            {
                appoint = new Appointment
                {
                    Docid = docid, type = type,
                    Date  = DateTime.ParseExact(dt, "dd/MM/yyyy-HH:mm", CultureInfo.InvariantCulture)
                },
                allstate = _context.States.ToList(),
                survey   = survey,
                checkout = false,
            };

            fview.allstate.RemoveAt(fview.allstate.Count - 1);
            return(View("_NewAppointment", fview));
        }