public async Task <IActionResult> AssignUserPlan(int userId, int planId) { var result = await _userPlanService.AssignUserPlanAsync(userId, planId); if (!result.Success) { return(BadRequest(result.Message)); } var planResource = _mapper.Map <Plan, PlanResource>(result.Resource.Plan); return(Ok(planResource)); }
public async Task <IActionResult> AssignUserPlan(int userId, int planId, [FromBody] SaveUserPlanResource resource) { var result = await _userPlanService.AssignUserPlanAsync(userId, planId, resource.DateOfUpdate); if (!result.Success) { return(BadRequest(result.Message)); } var petIllnesResource = _mapper.Map <UserPlan, UserPlanResource>(result.Resource); return(Ok(petIllnesResource)); }