public NewNutritionStandard GetData(SQLiteDataReader reader, string[] translations, string lang) { NewNutritionStandard x = new NewNutritionStandard(); x.code = reader.GetValue(0) == DBNull.Value ? null : reader.GetString(0); x.title = reader.GetValue(1) == DBNull.Value ? null : T.Tran(reader.GetString(1), translations, string.IsNullOrEmpty(lang) ? "hr" : lang); x.desc = reader.GetValue(2) == DBNull.Value ? null : T.Tran(reader.GetString(2), translations, string.IsNullOrEmpty(lang) ? "hr" : lang); Diets D = new Diets(); x.diet = D.GetDietData(reader.GetValue(3) == DBNull.Value ? null : reader.GetString(3), lang); x.energy = reader.GetValue(4) == DBNull.Value ? 0 : Convert.ToDouble(reader.GetString(4)); x.age = reader.GetValue(5) == DBNull.Value ? null : reader.GetString(5); x.gender = reader.GetValue(6) == DBNull.Value ? null : reader.GetString(6); x.country = reader.GetValue(7) == DBNull.Value ? null : reader.GetString(7); return(x); }
public ResultSvc <Diet> CreateDiet(Diet diet) { var result = new ResultSvc <Diet>(diet); try { if (!Diets.Items.Any(x => x.Name == diet.Name.Trim())) { diet.Name = diet.Name?.Trim(); diet.UserCreatedId = Context.HttpContext.User.GetUserId(); Diets.Add(diet); } else { result.Errors.Add("Strava s tímto názvem již existuje!"); } } catch (Exception e) { Logger.LogError(e.Message); } return(result); }
//Size Enum public Animal(string _name, Diets _diet, Sizes _size) { Name = _name; Size = _size; Diet = _diet; }
public Animal(Diets diet, Sizes size) { Diet = diet; Size = size; }