public ActionResult <String> Post([FromBody] Doctor doctor) { doctor.password = CreateMD5(doctor.password); _context.doctors.Add(doctor); _context.SaveChanges(); return(doctor.ID.ToString()); }
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); }
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(); }
public void PostHeartRate(HeartRate measurement) { _context.heartRates.Add(measurement); _context.SaveChanges(); }
public ActionResult <String> Post(Patient patient) { _context.patients.Add(patient); _context.SaveChanges(); return(patient.ID.ToString()); }