public Planning Create(Planning planning) { using (var connection = Database.GetConnection()) { connection.Open(); var command = connection.CreateCommand(); if (!_planningService.canCreate(planning)) { return(null); } command.CommandText = PlanningQueries.ReqCreate; command.Parameters.AddWithValue($"@{PlanningQueries.ColLabel}", planning.LabelPlanning); command.Parameters.AddWithValue($"@{PlanningQueries.ColIdSuperUser}", planning.IdSuperUser); planning.Id = (int)command.ExecuteScalar(); } return(planning); }