コード例 #1
0
 public ActionResult <String> Post([FromBody] Doctor doctor)
 {
     doctor.password = CreateMD5(doctor.password);
     _context.doctors.Add(doctor);
     _context.SaveChanges();
     return(doctor.ID.ToString());
 }
コード例 #2
0
        public ToDoItemModel AddToDo(string label)
        {
            int newId = 1;

            if (_dbContext.ToDoItems.Count() > 0)
            {
                newId = _dbContext.ToDoItems.Max <ToDoItemModel>(i => i.id) + 1;
            }
            var newItem = new ToDoItemModel {
                id = newId, label = label, completed = false
            };

            _dbContext.ToDoItems.Add(newItem);

            _dbContext.SaveChanges();

            return(newItem);
        }
コード例 #3
0
        public static void Initializa(InMemoryDBContext context)
        {
            context.patients.Add(new Patient("1991-05-24", 'M', "John Wick", 1, "65936503"));
            context.patients.Add(new Patient("1989-04-12", 'M', "Ethan Hunt", 1, "56112288"));
            context.patients.Add(new Patient("1988-02-12", 'M', "James Bond", 1, "562363416"));
            context.patients.Add(new Patient("1980-12-12", 'M', "Jason Bourne", 1, "145341656342"));

            context.doctors.Add(new Doctor("Dr. Manhattan", "1994-12-05", 'M', "05016881", "doctor", "5F4DCC3B5AA765D61D8327DEB882CF99"));
            context.doctors.Add(new Doctor("Dr. Jekyll", "1886-01-05", 'M', "05016881", "jekyll", "5F4DCC3B5AA765D61D8327DEB882CF99"));
            context.doctors.Add(new Doctor("Dr. Jens Jensen", "1971-01-01", 'M', "74030405", "jjs", "5F4DCC3B5AA765D61D8327DEB882CF99"));
            context.SaveChanges();
        }
コード例 #4
0
 public void PostHeartRate(HeartRate measurement)
 {
     _context.heartRates.Add(measurement);
     _context.SaveChanges();
 }
コード例 #5
0
 public ActionResult <String> Post(Patient patient)
 {
     _context.patients.Add(patient);
     _context.SaveChanges();
     return(patient.ID.ToString());
 }