public async Task DeleteAsync(Models.Dentist model) { var entity = _context.DentistTable.SingleOrDefault(e => e.Id == model.Id); _context.DentistTable.Remove(entity); await _context.SaveChangesAsync(); }
public Models.Dentist CreateDentist(Models.Dentist dentist) { Dentists dents = new Dentists(); dents.dentistsArray = LoadAllDentists(); dents.ColletionName = "Patients"; dents.Add(dentist); XmlSerializer serializer = new XmlSerializer(typeof(Dentists)); TextWriter writer = new StreamWriter(pathDentists); serializer.Serialize(writer, dents); writer.Close(); return(dentist); }
public static Contracts.Dentist ToContract(this Models.Dentist dentist) { if (dentist == null) { return(null); } return(new Contracts.Dentist() { Id = dentist.Id, FirstName = dentist.FirstName, LastName = dentist.LastName, Email = dentist.Email, Phone = dentist.Phone }); }
public async Task EditAsync(Models.Dentist model) { var entity = new Models.Dentist { Id = model.Id, Description = model.Description, FacebookUrl = model.FacebookUrl, LastName = model.LastName, Email = model.Email, Name = model.Name, Number = model.Number, Specialization = model.Specialization }; _context.Update(entity); await _context.SaveChangesAsync(); }
public async Task <Models.Dentist> AddAsync(Models.Dentist model) { var entity = new Models.Dentist { Id = model.Id, Description = model.Description, FacebookUrl = model.FacebookUrl, LastName = model.LastName, Email = model.Email, Name = model.Name, Number = model.Number, Specialization = model.Specialization }; await _context.DentistTable.AddAsync(entity); await _context.SaveChangesAsync(); return(model); }
public void Add(Models.Dentist p) { dentistsArray.Add(p); }