Example #1
0
        public IActionResult DeleteVolunteer(int Id)
        {
            var newVolunteer = _volunteerService.GetVolunteer(Id);

            if (newVolunteer != null)
            {
                _volunteerService.DeleteVolunteer(newVolunteer);
                return(Ok());
            }

            return(NotFound($"Volunteer with ID: {Id} cannot be found."));
        }
Example #2
0
        /// <summary>
        /// Delete Volunteer by id
        /// </summary>
        /// <param name="id">Volunteer id</param>
        /// <returns>true if the Volunteer is deleted successfully</returns>
        public bool Delete(int id)
        {
            try
            {
                // delete
                log.Debug("_volunteerService.DeleteVolunteer - volunteerId: " + id + " ");

                _volunteerService.DeleteVolunteer(id);

                log.Debug("result: 'success'");

                return(true);
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Example #3
0
        /// <summary>
        /// Delete Volunteer by id
        /// </summary>
        /// <param name="id">Volunteer id</param>
        /// <returns>true if the Volunteer is deleted successfully</returns>
        public IHttpActionResult Delete(int id)
        {
            try
            {
                // delete
                log.Debug("_volunteerService.DeleteVolunteer - volunteerId: " + id + " ");

                _volunteerService.DeleteVolunteer(id);

                log.Debug("result: 'success'");

                //return JsonConvert.SerializeObject(true);
                return(Ok(true));
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }