Ejemplo n.º 1
0
 public static Data_Specialty UnMapSpecialty(Inner_Specialty specialty)
 {
     return(new Data_Specialty
     {
         SpecialtyId = specialty.SpecialtyId,
         Specialty = specialty.Specialty
     });
 }
Ejemplo n.º 2
0
// ! ***********************************
// ! ********** Specialty **************
// ! ***********************************
        public static Transfer_Specialty MapSpecialty(Inner_Specialty specialty)
        {
            return(new Transfer_Specialty
            {
                SpecialtyId = specialty.SpecialtyId,
                Specialty = specialty.Specialty
            });
        }
Ejemplo n.º 3
0
        /// <summary> Updates one existing specialty in the database
        /// <param name="specialty"> Inner_Specialty Object - represents the fields of a Specialty in the database </param>
        /// <returns> no return </returns>
        /// </summary>
        public async Task UpdateSpecialtyAsync(Inner_Specialty specialty)
        {
            Data_Specialty currentEntity = await _context.Specialties.FindAsync(specialty.SpecialtyId);

            Data_Specialty newEntity = Mapper.UnMapSpecialty(specialty);

            _context.Entry(currentEntity).CurrentValues.SetValues(newEntity);
            await Save();
        }
Ejemplo n.º 4
0
        /// <summary> Add one specialty to the database
        /// <param name="specialty"> Inner_Specialty Object - represents the fields of a Specialty in the database </param>
        /// <returns> Returns inputted (and formatted) Specialty </returns>
        /// </summary>
        public async Task <Inner_Specialty> AddSpecialtyAsync(Inner_Specialty specialty)
        {
            var newSpecialty = Mapper.UnMapSpecialty(specialty);

            newSpecialty.SpecialtyId = (await GetSpecialtyAsync()).Max(p => p.SpecialtyId) + 1;
            _context.Specialties.Add(newSpecialty);
            await Save();

            return(Mapper.MapSpecialty(newSpecialty));
        }
        public async Task <IActionResult> PostAsync(Transfer_Specialty specialty)
        {
            _logger.LogInformation($"Adding new specialty.");
            Inner_Specialty transformedSpecialty = new Inner_Specialty
            {
                SpecialtyId = 0,
                Specialty   = specialty.Specialty
            };
            await _specialtyRepository.AddSpecialtyAsync(transformedSpecialty);

            return(CreatedAtAction(nameof(GetByIdAsync), new { id = specialty.SpecialtyId }, specialty));
        }
        public void APISpecialty_Behavior()
        {
            var             apiMapper = this.MakeMapper();
            Inner_Specialty specialty = new Inner_Specialty
            {
                SpecialtyId = 1,
                Specialty   = "Fake Specialty"
            };
            var outcome = Mapper.MapSpecialty(specialty);

            Assert.True(true);
            this.mockRepo.VerifyAll();
        }