public int CreateVolunteer(IVolunteer volunteerDTO)
 {
     Volunteer v = VolunteerFactory.CreateVolunteer(volunteerDTO);
     v = _store.Volunteers.Add(v);
     _store.SaveChanges();
     return v.Id;
 }
Example #2
0
        public int CreateVolunteer(IVolunteer volunteerDTO)
        {
            Volunteer v = VolunteerFactory.CreateVolunteer(volunteerDTO);

            v = _store.Volunteers.Add(v);
            _store.SaveChanges();
            return(v.Id);
        }
 public override int CreateVolunteer(IVolunteer volunteer)
 {
     _store.CreateIfNotExists();
     var blob = _store.GetBlockBlobReference($"{volunteer.Id}.txt");
     var json = JsonConvert.SerializeObject(volunteer);
     blob.UploadText(json);
     return volunteer.Id;
 }
        public override int CreateVolunteer(IVolunteer volunteer)
        {
            _store.CreateIfNotExists();
            var blob = _store.GetBlockBlobReference($"{volunteer.Id}.txt");
            var json = JsonConvert.SerializeObject(volunteer);

            blob.UploadText(json);
            return(volunteer.Id);
        }
Example #5
0
 public IHttpActionResult Post([FromBody] IVolunteer volunteer)
 {
     try
     {
         // TO-DO: replace with Created 201 response
         return(Ok(this.Service.CreateVolunteer(volunteer)));
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
        public static Volunteer CreateVolunteer(IVolunteer volunteerDTO) {

            if (volunteerDTO == null) return null;

            return new Volunteer
            {
                Id = volunteerDTO.Id,
                Description = volunteerDTO.Description,
                ZipCode = volunteerDTO.ZipCode,
                IsActive = volunteerDTO.IsActive
            };
        }
        public static Volunteer CreateVolunteer(IVolunteer volunteerDTO)
        {
            if (volunteerDTO == null)
            {
                return(null);
            }

            return(new Volunteer
            {
                Id = volunteerDTO.Id,
                Description = volunteerDTO.Description,
                ZipCode = volunteerDTO.ZipCode,
                IsActive = volunteerDTO.IsActive
            });
        }
Example #8
0
 public AdminController(IDonation donation, ILoanDonor loanDonor, IRecurringDonation recurringDonation,
                        ILoan loan, IContact contact, IUserProfile userProfile, ICause cause, IReview review, IVolunteer volunteer, IConfiguration config, IHttpContextAccessor accessor)
 {
     _cause             = cause;
     _recurringdonation = recurringDonation;
     _loan        = loan;
     _loandonor   = loanDonor;
     _volunteer   = volunteer;
     _donation    = donation;
     _contact     = contact;
     _review      = review;
     _userprofile = userProfile;
     _config      = config;
     _accessor    = accessor;
 }
Example #9
0
 public IHttpActionResult Put(int id, [FromBody] IVolunteer volunteer)
 {
     try
     {
         this.Service.UpdateVolunteer(volunteer);
         return(StatusCode(HttpStatusCode.NoContent));
     }
     catch (InvalidOperationException e) {
         return(BadRequest());
     }
     catch (Exception e)
     {
         return(InternalServerError());
     }
 }
        public void UpdateVolunteer(IVolunteer volunteerDTO)
        {
            Volunteer oldV = _store.Volunteers
                .Include(x => x.User)
                .Single(x => x.Id == volunteerDTO.Id);

            _store.Entry(oldV).CurrentValues.SetValues(volunteerDTO);
            _store.Entry(oldV.User).CurrentValues.SetValues(
                new {
                    FirstName = volunteerDTO.FirstName,
                    LastName = volunteerDTO.LastName,
                    Email = volunteerDTO.Email
                }
            );
            _store.SaveChanges();
        }
Example #11
0
        public void UpdateVolunteer(IVolunteer volunteerDTO)
        {
            Volunteer oldV = _store.Volunteers
                             .Include(x => x.User)
                             .Single(x => x.Id == volunteerDTO.Id);

            _store.Entry(oldV).CurrentValues.SetValues(volunteerDTO);
            _store.Entry(oldV.User).CurrentValues.SetValues(
                new {
                FirstName = volunteerDTO.FirstName,
                LastName  = volunteerDTO.LastName,
                Email     = volunteerDTO.Email
            }
                );
            _store.SaveChanges();
        }
 public void UpdateVolunteer(IVolunteer volunteer)
 {
     _volunteerList[volunteer.Id] = volunteer;
 }
 public int CreateVolunteer(IVolunteer volunteer)
 {
     _volunteerList.Add(volunteer.Id, volunteer);
     return volunteer.Id;
 }
Example #14
0
 public virtual void UpdateVolunteer(IVolunteer volunteer)
 {
     _service.UpdateVolunteer(volunteer);
 }
Example #15
0
 public virtual int CreateVolunteer(IVolunteer volunteer)
 {
     return(_service.CreateVolunteer(volunteer));
 }
Example #16
0
 public HomeController(IDisaster disasterSvc, IVolunteer volunteerSvc)
 {
     _disasterSvc = disasterSvc;
     _volunteerSvc = volunteerSvc;
 }
 public HomeController(IDisaster disasterSvc, IVolunteer volunteerSvc)
 {
     _disasterSvc  = disasterSvc;
     _volunteerSvc = volunteerSvc;
 }
 public VolunteerController(IVolunteer volunteer, IConfiguration config, IHttpContextAccessor accessor)
 {
     _volunteer = volunteer;
     _config    = config;
     _accessor  = accessor;
 }
 public virtual void UpdateVolunteer(IVolunteer volunteer)
 {
     _service.UpdateVolunteer(volunteer);
 }
 public int CreateVolunteer(IVolunteer volunteer)
 {
     _volunteerList.Add(volunteer.Id, volunteer);
     return(volunteer.Id);
 }
Example #21
0
 public VolunteersController(IVolunteer volunteer)
 {
     Volunteer = volunteer;
 }
 public void UpdateVolunteer(IVolunteer volunteer)
 {
     _volunteerList[volunteer.Id] = volunteer;
 }
Example #23
0
 public HomeController(IDisaster disasterSvc, IVolunteer volunteerSvc, IWebSecurityWrapper webSecurity)
 {
     _disasterSvc = disasterSvc;
     _volunteerSvc = volunteerSvc;
     _webSecurity = webSecurity;
 }
 public AccountController(IVolunteer volunteerSvc, ICluster clusterSvc)
 {
     _clusterSvc = clusterSvc;
     _volunteerSvc = volunteerSvc;
 }
 public AccountController(IVolunteer volunteerSvc, ICluster clusterSvc)
 {
     _clusterSvc   = clusterSvc;
     _volunteerSvc = volunteerSvc;
 }
 public virtual int CreateVolunteer(IVolunteer volunteer)
 {
     return _service.CreateVolunteer(volunteer);
 }
Example #27
0
 public HomeController(IDisaster disasterSvc, IVolunteer volunteerSvc, IWebSecurityWrapper webSecurity)
 {
     _disasterSvc  = disasterSvc;
     _volunteerSvc = volunteerSvc;
     _webSecurity  = webSecurity;
 }