示例#1
0
        public async Task <bool> UpdateVolunteeringPreferenceAsync(UpdateVolunteeringPreferenceRequest request)
        {
            //get the data
            //update the data
            //push it to DB
            var copier  = new ClassValueCopier();
            var olduser = await _usersCollection.GetAsync(request.UserCode);

            var newuser = copier.ConvertAndCopy(request, olduser);

            newuser.LastUpdatedBy = request.UserCode;
            return(await _usersCollection.UpdateAsync(newuser));
        }
        public async Task <IActionResult> UpdateVolunteeringPreference(UpdateVolunteeringPreferenceRequest request)
        {
            ActionResponse response;

            try
            {
                bool result = await _businessLogic.UpdateVolunteeringPreferenceAsync(request);

                response = (result) ? new ActionResponse(StatusCodes.Status200OK) : new ActionResponse(StatusCodes.Status422UnprocessableEntity);
            }
            catch (Exception ex)
            {
                response = new ActionResponse(StatusCodes.Status500InternalServerError);
                response.StatusDescription += ex.Message.ToString();
            }
            return(StatusCode(response.StatusCode, response));
        }