Example #1
0
        public async Task DeleteAsync(Models.Dentist model)
        {
            var entity = _context.DentistTable.SingleOrDefault(e => e.Id == model.Id);

            _context.DentistTable.Remove(entity);
            await _context.SaveChangesAsync();
        }
Example #2
0
        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);
        }
Example #3
0
        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
            });
        }
Example #4
0
        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();
        }
Example #5
0
        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);
        }
Example #6
0
 public void Add(Models.Dentist p)
 {
     dentistsArray.Add(p);
 }