public async Task <UserTrackedItem> CreateOrUpdateTrackedItemAsync(TrackedBowelMovementItem trackedItem, string userId) { var isNewItem = await CreateOrUpdateItemPreProcessingAsync(trackedItem, userId); trackedItem.Description = "Bowel Movement"; trackedItem.ValidateValuesForSubmission(isNewItem); var userTask = GetOrCreateUserFromDbAsync(userId); var insertedItem = await _elmDb.UpsertTrackedItem(trackedItem); await CreateOrUpdateItemPostProcessingAsync(trackedItem, await userTask); return(insertedItem); }
public async Task <ActionResult <UserTrackedItem> > CreateOrUpdateTrackedFoodItemAsync([FromBody] TrackedBowelMovementItem trackedItemObject) { var user = GetUserObjectFromClaims(HttpContext.User.Claims); return(await _trackItemBl.CreateOrUpdateTrackedItemAsync(trackedItemObject, user.ObjectId)); }