Ejemplo n.º 1
0
    /// <summary>
    /// Get count of days since last recipe preparation.
    /// </summary>
    /// <param name="recipeID">ID of the recipe for which count needed.</param>
    /// <returns>Count of days that passed from last time selected recipe was cooked. E.g. if it was cooked yesterday, returns 1.</returns>
    public int DaysFromLasCook(Guid recipeID)
    {
        DateTime?date = dayService.GetLastCookedDate(recipeID);

        return(date != null
                    ? (int)(DateTime.Now - date.Value).TotalDays
                    : int.MaxValue);
    }