Пример #1
0
        public int AddVolunteer(VolunteerDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(VolunteerDTO.FormatVolunteerDTO(dto));

                R_Volunteer t = VolunteerDTO.ConvertDTOtoEntity(dto);

                // add
                id = Repository.AddVolunteer(t);
                dto.VolunteerId = id;

                log.Debug("result: 'success', id: " + id);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }

            return(id);
        }
Пример #2
0
        public void DeleteVolunteer(VolunteerDTO dto)
        {
            try
            {
                log.Debug(VolunteerDTO.FormatVolunteerDTO(dto));

                R_Volunteer t = VolunteerDTO.ConvertDTOtoEntity(dto);

                // delete
                Repository.DeleteVolunteer(t);
                dto.IsDeleted = t.IsDeleted;

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Пример #3
0
        public void UpdateVolunteer(VolunteerDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "VolunteerId");

                log.Debug(VolunteerDTO.FormatVolunteerDTO(dto));

                R_Volunteer t = VolunteerDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateVolunteer(t);

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }