Beispiel #1
0
        public void Specialty_Service_Update_Valid_Specialty()
        {
            // Arrange
            var specialtyBuilder = new SpecialtyBuilder(LocalNotification)
                                   .WithId(1)
                                   .WithDescription("Cirurgia Vascular");

            // Act
            _specialtyService.UpdateSpecialty(specialtyBuilder);

            // Assert
            Assert.False(LocalNotification.HasNotification());
        }
Beispiel #2
0
        public SpecialtyDto UpdateSpecialty(int id, SpecialtyDto specialty)
        {
            if (id <= 0)
            {
                RaiseNotification(nameof(id));
            }

            if (specialty == null)
            {
                RaiseNotification(nameof(specialty));
            }

            if (Notification.HasNotification())
            {
                return(new SpecialtyDto());
            }

            var specialtyBuilder = new SpecialtyBuilder(Notification)
                                   .WithId(id)
                                   .WithDescription(specialty.Description);

            _service.UpdateSpecialty(specialtyBuilder);

            specialty.Id = id;
            return(specialty);
        }
Beispiel #3
0
        public async Task <IActionResult> SpecialtyUpdate(int specialtyId, string name, int lectorId, string shortName)
        {
            var result = await _specialtyService.UpdateSpecialty(specialtyId, lectorId, name, shortName);

            if (result == null)
            {
                return(NotFound());
            }

            var specialty = _mapper.Map <SpecialtyResponse>(result);

            return(Ok(specialty));
        }