예제 #1
0
        public async Task Search_Existing_Activity()
        {
            Activity activity = await _activitiesRepository.FindByIdAsync(1);

            Assert.IsNotNull(activity);
            Assert.AreEqual(PeriodicityType.Casual, activity.Periodicity);
            Assert.AreEqual(ActivityState.Pending, activity.State);
        }
예제 #2
0
        public async Task <ActionResult <ActivityViewModel> > GetActivity(int id)
        {
            Activity activity = await _activitiesRepository.FindByIdAsync(id);

            if (activity == null)
            {
                return(NotFound($"No existe ninguna actividad con el código {id}."));
            }

            return(_mapper.Map <ActivityViewModel>(activity));
        }
        private async Task <Activity> UpdateActivityToApplied(int activityCode)
        {
            Activity activity = await _activitiesRepository.FindByIdAsync(activityCode);

            if (activity != null)
            {
                activity.State = ActivityState.Applied;
                _activitiesRepository.Update(activity);
            }

            return(activity);
        }