public async Task <RequestForVolunteer> CreateRequestForVolunteer(RequestForVolunteer request) { request.CreatedOn = DateTime.Now; request.LastUpdatedOn = DateTime.Now; _dbContext.Add(request); await _dbContext.SaveChangesAsync(); return(request); }
public async Task <bool> UpdateRequestForVolunteer(RequestForVolunteer request) { request.LastUpdatedOn = DateTime.Now; _dbContext.Entry(request).Property(x => x.EventName).IsModified = true; _dbContext.Entry(request).Property(x => x.Date).IsModified = true; _dbContext.Entry(request).Property(x => x.Location).IsModified = true; _dbContext.Entry(request).Property(x => x.FromTime).IsModified = true; _dbContext.Entry(request).Property(x => x.ToTime).IsModified = true; _dbContext.Entry(request).Property(x => x.WaiverRequired).IsModified = true; _dbContext.Entry(request).Property(x => x.Status).IsModified = true; return(await _dbContext.SaveChangesAsync() > 0 ? true : false); }