public void UpdateNutrient(Nutrient nutrient) { using var conn = CreateConnection(); using var tran = conn.BeginTransaction(); try { conn.Execute("UPDATE Nutrient SET Name=@Name, ShortName=@ShortName, Unit=@Unit, FineliId=@FineliId, FineliClass=@FineliClass, FineliGroup=@FineliGroup, DefaultOrder=@DefaultOrder,DefaultHideSummary=@DefaultHideSummary,DefaultHideDetails=@DefaultHideDetails WHERE Id=@Id", nutrient, tran); tran.Commit(); } catch { throw; } }
public void CreateNutrient(Nutrient nutrient) { using var conn = CreateConnection(); using var tran = conn.BeginTransaction(); try { conn.Execute("INSERT INTO Nutrient(Name,ShortName,Unit,FineliId,FineliClass,FineliGroup,DefaultOrder,DefaultHideSummary,DefaultHideDetails) VALUES(@Name,@ShortName,@Unit,@FineliId,@FineliClass,@FineliGroup,@DefaultOrder,@DefaultHideSummary,@DefaultHideDetails)", nutrient, tran); tran.Commit(); } catch { throw; } }