public void Update(CookingProcedureStep step) { using (var conn = this.dbConnection.GetOpenConnection()) { if (step.Id == 0) { conn.Execute(@"INSERT INTO CookingProcedures (RecipeId, Step) VALUES (@RecipeId, @Step)", step); } else { conn.Execute(@"UPDATE CookingProcedures SET Step = @Step WHERE Id = @Id", step); } } }
public CookingProcedureStep FromDto(CookingProcedureDto step) { if (step == null) { return(null); } var model = new CookingProcedureStep(); model.Id = step.Id; model.RecipeId = step.RecipeId; model.Step = step.Step; return(model); }